I don’t know what is wrong in my code
The last line doesn’t run.
Not sure if the if statements aren’t ending or what is going on
today = system.date.now()
dayBefore = system.date.addDays(today, -1)
shift3yesterday = system.date.setTime(dayBefore, 23, 0, 0)
shift1today = system.date.setTime(today, 7, 0, 0)
shift2today = system.date.setTime(today, 15, 0, 0)
shift3today = system.date.setTime(today, 23, 0, 0)
if system.date.isbefore(today,shift1today) :
currentshiftstart=shift3yesterday
if system.date.isbetweeen(today,shift1today,shift2today) :
currentshiftstart=shift1today
if system.date.isbetween(today,shift2today,shift3today):
currentshiftstart=shift2today
if system.date.isafter(today,shift3today) :
currentshiftstart=shift3today
system.tag.writeBlocking(["[.]Current Shift Start"], [today])