This issue was submitted on the lucee forum at:
https://dev.lucee.org/t/54-weeks-in-2020/7749
e.g. if you run the following code:
The result for variable wrongWeek is 54. Expected value should be 52.
This happens on 5.3.7.47 and below. According to the users post, this issue happens even on Railo Lucee 4.5.5
please give that build an other try
, I've checked this ticket with fixed version 5.3.8.137-SNAPSHOT and the issue was sloved. Now week() return correct result.
could you please check with fixed version.
Thanks for notifying and quick fix + PR. and sorry for my delayed reply. Just verified the scripts code. I’m getting week 53 with Lucee 5.3.8.138-SNAPSHOT for all TimeZones.. But(!!!) in my CET Timezone it should be 52 ( {ts '2020-12-27 0:00:00'} is a Sunday and 53 starts on Monday) . Week() of the date {ts '2020-12-27 0:00:00'} in TimeZone “CET” should return 52, not 53. ACF returns correctly 52 for TimeZone CET.
Please see the results with the following code on ACF2021:
https://trycf.com/gist/6e7d5719d43f3d46b721041c950f2150/acf2021?theme=monokai
Ouputs on ACF2021:
Etc/UTC:53
CET:52
PST:53
AGT:53
CST:53
UTC:53
Maybe the fixed function should consider locales. I’ve googled a bit and found the following information:
https://www.baeldung.com/java-get-week-number#3-locale-differences
that’s why LsWeek() exists https://docs.lucee.org/reference/functions/lsweek.html
so LsWeek() needs updating too
https://trycf.com/gist/da75d9ab742a7f748fc84f1295280e85/lucee5?theme=monokai
It seems Adobe does week by current UTC time of that timezone.
ex. “12/27/2020 0:00:00” with JST timezone set returns 52 on ACF (UTC=”12/26/2020 15:00:00”) . Lucee is assuming the current set time zone.