feature: saved exports view/edit/trigger

This commit is contained in:
Gary Sharp
2025-02-12 18:36:30 +11:00
parent 59dc0b9d5a
commit eec8ba438c
40 changed files with 3042 additions and 1187 deletions
@@ -8,5 +8,26 @@ namespace Disco.Models.Services.Exporting
public byte WeekDays { get; set; }
public byte StartHour { get; set; }
public byte? EndHour { get; set; }
public bool IncludesDay(DayOfWeek day)
=> (WeekDays & (1 << (int)day)) != 0;
public string StartHourFriendly()
=> HourFriendly(StartHour);
public string EndHourFriendly()
=> EndHour.HasValue ? HourFriendly(EndHour.Value) : string.Empty;
private static string HourFriendly(int hour)
{
if (hour == 0)
return "12:00 AM";
else if (hour < 12)
return $"{hour}:00 AM";
else if (hour == 12)
return "12:00 PM";
else
return $"{hour - 12}:00 PM";
}
}
}