Add configuration file support

This commit is contained in:
Marko Korhonen 2023-11-22 20:57:42 +02:00
parent d141fe1d36
commit ab51b4c11d
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
7 changed files with 204 additions and 51 deletions

View file

@ -5,7 +5,7 @@ import duration, { Duration } from 'dayjs/plugin/duration.js';
dayjs.extend(customParseFormat);
dayjs.extend(duration);
export const parseTimestamp = (time: string): Dayjs => dayjs(time, 'HH:mm', true);
export const parseTimestamp = (time: string): Dayjs => (time === 'now' ? dayjs() : dayjs(time, 'HH:mm', true));
export const parseDuration = (time: string): Duration => {
const [hours, minutes] = time.split(':').map(Number);