it("can also shift UTC into other timeZones",async()=>{
// UTC+0 time with 23:00 - 23:59 (Sunday) and 00:00 - 16:00 (Monday) when cast into UTC+1 should become 00:00 = 17:00 (Monday)
expect(
getWorkingHours({utcOffset:-60},[
{
days:[0],
startTime: newDate(Date.UTC(2021,11,16,23)),
endTime: newDate(Date.UTC(2021,11,16,23,59)),
},
{
days:[1],
startTime: newDate(Date.UTC(2021,11,17,0)),
endTime: newDate(Date.UTC(2021,11,17,16)),
},
])
).toStrictEqual([
// TODO: Maybe the desired result is 0-1020 as a single entry, but this requires some post-processing to merge. It may work as is so leaving this as now.
{
days:[1],
endTime: 59,
startTime: 0,
},
{
days:[1],
endTime: 1020,
startTime: 60,
},
]);
// And the other way around; UTC+0 time with 00:00 - 1:00 (Monday) and 21:00 - 24:00 (Sunday) when cast into UTC-1 should become 20:00 = 24:00 (Sunday)
expect(
getWorkingHours({utcOffset: 60},[
{
days:[0],
startTime: newDate(Date.UTC(2021,11,16,21)),
endTime: newDate(Date.UTC(2021,11,16,23,59)),
},
{
days:[1],
startTime: newDate(Date.UTC(2021,11,17,0)),
endTime: newDate(Date.UTC(2021,11,17,1)),
},
])
).toStrictEqual([
// TODO: Maybe the desired result is 1200-1439 as a single entry, but this requires some post-processing to merge. It may work as is so leaving this as now.