mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-16 10:58:32 -05:00
Support the day of the event
This commit is contained in:
@@ -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 : {
|
||||
|
||||
Reference in New Issue
Block a user