mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-24 09:35:39 -05:00
Replace calendar service with new .NET version
This commit is contained in:
17
Calendar/Service/Models/HolidayEntry.cs
Normal file
17
Calendar/Service/Models/HolidayEntry.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace ChrisKaczor.HomeMonitor.Calendar.Service.Models;
|
||||
|
||||
public class HolidayEntry
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public DateTimeOffset Date { get; set; }
|
||||
public bool IsToday { get; set; }
|
||||
public Duration DurationUntil { get; set; }
|
||||
|
||||
public HolidayEntry(CalendarEntry calendarEntry, TimeZoneInfo timeZoneInfo)
|
||||
{
|
||||
Name = calendarEntry.Summary;
|
||||
Date = TimeZoneInfo.ConvertTime(calendarEntry.Start, timeZoneInfo).Subtract(timeZoneInfo.GetUtcOffset(calendarEntry.Start));
|
||||
IsToday = Date.Date == DateTimeOffset.UtcNow.Date;
|
||||
DurationUntil = new Duration(Date);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user