ts-py-datetime
Version:
Datetime handling the python way (or as close as possible), now with TypeScript
25 lines (24 loc) • 531 B
JavaScript
export const TimeIntervals = [
'hour',
'minute',
'second',
'millisecond',
];
export const DateIntervals = ['year', 'month', 'day'];
export const DatetimeIntervals = [...DateIntervals, ...TimeIntervals];
export const TimedeltaIntervals = [
'weeks',
'days',
'hours',
'minutes',
'seconds',
'milliseconds',
];
export const toSeconds = {
weeks: 60 * 60 * 24 * 7,
days: 60 * 60 * 24,
hours: 60 * 60,
minutes: 60,
seconds: 1,
milliseconds: 0.001,
};