timepiece/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.mjs

18 lines
435 B
JavaScript
Raw Normal View History

2024-05-14 14:54:12 +00:00
import { constructFrom } from "../../../constructFrom.mjs";
import { Parser } from "../Parser.mjs";
import { parseAnyDigitsSigned } from "../utils.mjs";
export class TimestampSecondsParser extends Parser {
priority = 40;
parse(dateString) {
return parseAnyDigitsSigned(dateString);
}
set(date, _flags, value) {
return [constructFrom(date, value * 1000), { timestampIsSet: true }];
}
incompatibleTokens = "*";
}