319ca56ac603d151e57da097d3e19ea19ec159a2cea280b1874ef085d5bfc1a9706b14286c873e1323b058f7b4bc91f469477deb2551baab53511191318121 594 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, 10) * 1000);
  13. });
  14. addParseToken('x', function (input, array, config) {
  15. config._d = new Date(toInt(input));
  16. });