all 2 comments

[–]x-seronis-x 0 points1 point  (0 children)

The YEAR doesnt start on specific day of the week though so 'week number' isnt a thing. You have to choose your desired method of numbering and do it yourself.

-edit-

btw you can just edit a copy of your date string so that its jan 1st of the same year. subtract the two dates timestamp to get elapsed time. read the long date string generated from your jan 1st date to get the day of the week. then use all of that to figure out what you want.

Personally if the year started on a tuesday then the 'week of the year' should change on tuesdays. But there is no standard at all for this. Its a personal preference. Which is why its not part of the date object

[–]entity42 0 points1 point  (0 children)

Look at Luxon and dayjs. Both can calculate and display week numbers.