How to use the isISO8601 function from validator

Find comprehensive JavaScript validator.isISO8601 code examples handpicked from public code repositorys.

1004
1005
1006
1007
1008
1009
1010
1011
1012
    data[f] = JSON.stringify(v);

  } else if (toolkit.endsWith(f, 'Time')
    // 时间类字段
    && 'string' === typeof v
    && validator.isISO8601(v, { strict: true, strictSeparator: true })) {
        data[f] = new Date(v);
  }
}
fork icon34
star icon185
watch icon0

+ 2 other calls in file

-2
-1
  return v.isISO8601(String(value));
};
fork icon32
star icon84
watch icon5

15
16
17
18
19
20
21
22
23
24
  return (value === 'true' || value === true || value === '1' || value === 1);
};

// Add isDate method to Validator object
V.isDate = function (value) {
  return (V.isRFC3339(value) || V.isISO8601(value));
};

// Add toIntFix method to Validator object to handle numeric output
V.toIntFix = function (value) {
fork icon10
star icon11
watch icon2

+ 10 other calls in file

202
203
204
205
206
207
208
209
210
211
 * Check if date string is ISO 8601 compliant.
 * @param str
 * @returns {*}
 */
var isISO8601 = module.exports.isISO8601 = function isISO8601(str) {
  return validator.isISO8601(str);
};

/**
 * Check if string is a blank node.
fork icon2
star icon6
watch icon21

2
3
4
5
6
7
8
9
10
11
function isFormat(str, format) {
  if (!format) return true;

  switch(format) {
    case 'iso8601':
      return isISO8601(str);
    default:
      return false;
  }
}
fork icon0
star icon4
watch icon2

1
2
3
4
5
6
7
8
9
10

var t = require('tcomb');

var _require = require('validator'),
    isUUID = _require.isUUID,
    isISO8601 = _require.isISO8601;

var PercentClass = t.enums.of(['success', 'warning', 'danger'], 'PercentClass');
var TestState = t.enums.of(['passed', 'failed'], 'TestState');
var TestSpeed = t.enums.of(['slow', 'medium', 'fast'], 'TestSpeed');
fork icon84
star icon0
watch icon12

-1
exports.isISO8601 = value => validator.isISO8601(value.toISOString());
fork icon0
star icon0
watch icon5