lib/heimdallr-validator.js
function validTimestamp(timestamp) {
    // ^year-month-day(Thour:min:secms?timezone)?$
    var year = /((?:[1-9][0-9]*)?[0-9]{4})/,
        month = /(1[0-2]|0[1-9])/,
        day = /(3[01]|0[1-9]|[12][0-9])/,
        hour = /(2[0-3]|[01][0-9])/,
        minute = /([0-5][0-9])/,
        second = /([0-5][0-9])/,
        ms = /(\.[0-9]+)/,
        timezone = /(Z|[+\-](?:2[0-3]|[01][0-9]):[0-5][0-9])/,
        date = [year.source, month.source, day.source].join('-'),
        time = [hour.source, minute.source, second.source].join(':'),
        timestampRegex,
        result;

    timestampRegex = new RegExp(
        '^' + date + '(T' + time + ms.source + '?' + timezone.source + ')?$'
    );

    result = timestampRegex.exec(timestamp);

    return result !== null;
}
function validTimestamp(timestamp) {
    // ^year-month-day(Thour:min:secms?timezone)?$
    var year = /((?:[1-9][0-9]*)?[0-9]{4})/,
        month = /(1[0-2]|0[1-9])/,
        day = /(3[01]|0[1-9]|[12][0-9])/,
        hour = /(2[0-3]|[01][0-9])/,
        minute = /([0-5][0-9])/,
        second = /([0-5][0-9])/,
        ms = /(\.[0-9]+)/,
        timezone = /(Z|[+\-](?:2[0-3]|[01][0-9]):[0-5][0-9])/,
        date = [year.source, month.source, day.source].join('-'),
        time = [hour.source, minute.source, second.source].join(':'),
        timestampRegex,
        result;

    timestampRegex = new RegExp(
        '^' + date + '(T' + time + ms.source + '?' + timezone.source + ')?$'
    );

    result = timestampRegex.exec(timestamp);

    return result !== null;
}
function validTimestamp ( timestamp ) { // ^year-month-day(Thour:min:secms?timezone)?$ var year = / ((?:[1-9][0-9]*)?[0-9]{4}) / , month = / (1[0-2]|0[1-9]) / , day = / (3[01]|0[1-9]|[12][0-9]) / , hour = / (2[0-3]|[01][0-9]) / , minute = / ([0-5][0-9]) / , second = / ([0-5][0-9]) / , ms = / (\.[0-9]+) / , timezone = / (Z|[+\-](?:2[0-3]|[01][0-9]):[0-5][0-9]) / , date = [ year . source , month . source , day . source ] . join ( '-' ) , time = [ hour . source , minute . source , second . source ] . join ( ':' ) , timestampRegex , result ; timestampRegex = new RegExp ( '^' + date + '(T' + time + ms . source + '?' + timezone . source + ')?$' ) ; result = timestampRegex . exec ( timestamp ) ; return result !== null ; }
Verifies that the input string follows the ISO 8601 standard.

@arg {string} timestamp - The timestamp to validate.
@return {boolean} True if <tt>timestamp</tt> is a valid ISO 8601 string.
Verifies that the input string follows the ISO 8601 standard .