Support the day of the event

This commit is contained in:
2024-01-15 09:31:33 -05:00
parent 1cffbbbed7
commit dceb8b91a3
2 changed files with 19 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ export class Event {
name: string;
date: DateTime;
type: HolidaysTypes.HolidayType;
isToday: boolean;
durationUntil: {
days: number;
hours: number;
@@ -16,7 +17,8 @@ export class Event {
this.name = holiday.name;
this.date = DateTime.fromFormat(holiday.date, 'yyyy-MM-dd HH:mm:ss', { zone: timezone });
this.type = holiday.type;
this.isToday = this.date.hasSame(DateTime.now(), 'day');
const duration = Interval.fromDateTimes(DateTime.now(), this.date).toDuration(['days', 'hours', 'minutes', 'seconds']);
this.durationUntil = !duration.isValid ? null : {