Closed ryandb closed 2 years ago
This is likely due to locale settings. Can you check what Luxon does when formatting dates and what WW
correspond to?
You are correct. Also - I used the incorrect format string when formatting with weeks. 'yyyy' is not the correct format string to use -- 'kkkk' returns the appropriate year for the corresponding week calc.
var myDate = DateTime.fromISO('2022-01-01')
var myDateAsWrongWeek = myDate.toFormat("yyyy-WW")
var myDateAsCorrectWeek = myDate.toFormat("kkkk-WW")
dv.paragraph(myDate)
dv.paragraph(myDate.zoneName)
dv.paragraph(myDateAsWrongWeek)
dv.paragraph(myDateAsCorrectWeek)
returns:
January 01, 2022
America/Los_Angeles
2022-52
2021-52
Closing this issue. (For future reference - my disconnect was caused by a bug in the calendar plugin: detailed here .
What happened?
Week number calculation appears to be incorrect:
dateformat(date("2022-01-01"), "yyyy-'W'W" ==> evaluates to 2022-W52 dateformat(date("2022-08-20"), "yyyy-'W'W" ==> evaluates to 2022-W33 (should be 34)
DQL
=dateformat(date("2022-01-01"), "yyyy-'W'W"
JS
No response
Dataview Version
0.5.41
Obsidian Version
0.15.9
OS
MacOS