diff --git a/devdocs/solutions.txt b/devdocs/solutions.txt index 582722a7..302657fe 100644 --- a/devdocs/solutions.txt +++ b/devdocs/solutions.txt @@ -233,4 +233,16 @@ https://en.wikipedia.org/wiki/Non-functional_requirement ## ASCII ART -//http://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=PM \ No newline at end of file +//http://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=PM + +## Time zone stuff +//play with any time zone with codes +http://www.timezoneconverter.com/cgi-bin/zoneinfo + +//list of time zone offsets +https://en.wikipedia.org/wiki/List_of_UTC_time_offsets + +Good test time zones: +America/St_Johns - because it has a fractional hour difference +America/New_York +America/Los_Angeles diff --git a/server/AyaNova/Controllers/ScheduleController.cs b/server/AyaNova/Controllers/ScheduleController.cs index f4895673..fbba6ad4 100644 --- a/server/AyaNova/Controllers/ScheduleController.cs +++ b/server/AyaNova/Controllers/ScheduleController.cs @@ -86,18 +86,18 @@ namespace AyaNova.Api.Controllers s.Id = v.WoItemSchedUserId; s.Color = ColorFromWOItem(v, p); s.TextColor = TextColor(s.Color); - s.Start = EpochSeconds(v.StartDate); - s.End = EpochSeconds(v.StopDate); + s.Start = EpochSeconds(v.StartDate, p.TZOffset); + s.End = EpochSeconds(v.StopDate, p.TZOffset); s.Type = AyaType.WorkOrderItemScheduledUser; s.Name = NameFromWOItem(v, p); return s; } - private static long? EpochSeconds(DateTime? dt) + private static long? EpochSeconds(DateTime? dt, int tzOffset = 0) { if (dt == null) return null; DateTimeOffset dto = new DateTimeOffset((DateTime)dt); - return dto.ToUnixTimeMilliseconds(); + return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000); } private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p) @@ -151,6 +151,7 @@ namespace AyaNova.Api.Controllers public class PersonalScheduleParams { public ScheduleView View { get; set; } + public int TZOffset { get; set; } public DateTime Start { get; set; } public DateTime End { get; set; } public PersonalScheduleWorkOrderColorSource ColorSource { get; set; }