I have a virtual column which calculates a duration between the current time and the latest previous time. When the entry is open for edit, the virtual duration column is correct, but when saving the entry, the virtual column reverts to a duration of an hour more than the actual duration. I have tracked this to an issue with daylight savings, but I can't figure out how to fix it.
I'm afraid this is a long time and known bug with daylight saving. A workaround is to add +1 or -1 hour depending on the start or end date.
Here's a formula you can use to determine if a date in inside DST or not:
if(
SWITCH(MONTH(NOW()),
3, today() >= EOWEEK(date(Concatenate("3/1/", text(today(), "yyyy")))) + 8,
11, today() < EOWEEK(date(Concatenate("11/1/", text(today(), "yyyy")))) + 1,
AND(
MONTH(NOW()) > 3,
MONTH(NOW()) < 11
)
),
"001:00:00",
"000:00:00"
)
Here's how it works:
This formula dynamically calculates the start and end dates of DST by using the `EOWEEK` function to find the relevant Sundays in March and November. By concatenating the year from the current date, it ensures the calculation is always based on the current year, making it automatically adjust for future years without needing to manually update the year in the formula.
User | Count |
---|---|
37 | |
30 | |
29 | |
20 | |
18 |