Sha256: cbead1322b261f608ba8359c5081c5de135b001636e9a359fa429e3511c35cb1

Contents?: true

Size: 988 Bytes

Versions: 16

Compression:

Stored size: 988 Bytes

Contents

import extend from '../utils/extend';
import { createUTC } from './utc';
import getParsingFlags from '../create/parsing-flags';

export function isValid(m) {
    if (m._isValid == null) {
        var flags = getParsingFlags(m);
        m._isValid = !isNaN(m._d.getTime()) &&
            flags.overflow < 0 &&
            !flags.empty &&
            !flags.invalidMonth &&
            !flags.invalidWeekday &&
            !flags.nullInput &&
            !flags.invalidFormat &&
            !flags.userInvalidated;

        if (m._strict) {
            m._isValid = m._isValid &&
                flags.charsLeftOver === 0 &&
                flags.unusedTokens.length === 0 &&
                flags.bigHour === undefined;
        }
    }
    return m._isValid;
}

export function createInvalid (flags) {
    var m = createUTC(NaN);
    if (flags != null) {
        extend(getParsingFlags(m), flags);
    }
    else {
        getParsingFlags(m).userInvalidated = true;
    }

    return m;
}

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
locomotivecms-3.2.0.rc1 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
locomotivecms-3.1.1 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
locomotivecms-3.1.0 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
locomotivecms-3.1.0.rc3 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
locomotivecms-3.1.0.rc2 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
locomotivecms-3.1.0.rc1 vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/moment/src/lib/create/valid.js
date_picker-0.0.8 test/dummy/vendor/assets/components/moment/src/lib/create/valid.js
date_picker-0.0.7 test/dummy/vendor/assets/components/moment/src/lib/create/valid.js