export function parse_datetime(input) {
- const re = /^(?:(?<year>[0-9]{4})-(?<month>[0-9]{1,2})-(?<day>[0-9]{1,2})\s)?\s*(?<hour>[0-9]{1,2}):(?<minute>[0-9]{2})(?::(?<second>[0-9]{2}))?$/;
+ const re = /^(?:(?<year>[0-9]{4})-(?<month>[0-9]{1,2})-(?<day>[0-9]{1,2})\s)?\s*(?<hour>[0-9]{1,2}):(?<minute>[0-9]{1,2})(?::(?<second>[0-9]{1,2}))?$/;
const match = input.match(re);
if (match === null) return null;
const datetime = new Date();
}
export function parse_duration(input) {
- const re = /^(?:(?<hours>[0-9]{1,2}):)?(?<minutes>[0-9]{2}):(?<seconds>[0-9]{2})$/;
+ const re = /^(?:(?<hours>[0-9]{1,2}):)?(?<minutes>[0-9]{1,2}):(?<seconds>[0-9]{1,2})$/;
const match = input.match(re);
if (match === null) return null;
return ((((match.groups.hours !== undefined ? +match.groups.hours : 0) * 60 + +match.groups.minutes) * 60) + +match.groups.seconds) * 1000;