9ac9375025866a5f8b954d80f0b914b47943219172bd79feaff79eba4791e0e94c4ade1ec6fc4426970391ea608dbbe0dae84914a18d9fc2447ae76d533e24 590 B

1234567891011121314151617181920
  1. import { addFormatToken } from '../format/format';
  2. import { addRegexToken, matchTimestamp, matchSigned } from '../parse/regex';
  3. import { addParseToken } from '../parse/token';
  4. import toInt from '../utils/to-int';
  5. // FORMATTING
  6. addFormatToken('X', 0, 0, 'unix');
  7. addFormatToken('x', 0, 0, 'valueOf');
  8. // PARSING
  9. addRegexToken('x', matchSigned);
  10. addRegexToken('X', matchTimestamp);
  11. addParseToken('X', function (input, array, config) {
  12. config._d = new Date(parseFloat(input) * 1000);
  13. });
  14. addParseToken('x', function (input, array, config) {
  15. config._d = new Date(toInt(input));
  16. });