refactor: rewrite scheduler as functional

This commit is contained in:
Ali BARIN
2022-10-06 23:11:14 +02:00
committed by Faruk AYDIN
parent 0f3d1f0173
commit 45c0995d9d
16 changed files with 749 additions and 822 deletions

View File

@@ -0,0 +1,14 @@
import { DateTime } from 'luxon';
export default function getDateTimeObjectRepresentation(dateTime: DateTime) {
const defaults = dateTime.toObject();
return {
...defaults,
ISO_date_time: dateTime.toISO(),
pretty_date: dateTime.toLocaleString(DateTime.DATE_MED),
pretty_time: dateTime.toLocaleString(DateTime.TIME_WITH_SECONDS),
pretty_day_of_week: dateTime.toFormat('cccc'),
day_of_week: dateTime.weekday,
};
}