mobily / rescript-date

📆 Date manipulation in ReScript.

Home Page:https://mobily.github.io/rescript-date

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you calculate a date from a week number?

vasco3 opened this issue · comments

let date = Js.Date.fromString("2021-01-05")

date->ReDate.getWeek // returns 1

do you know how can I convert that "2021-W1" back to a date?

I would like to be able to get the start of that week.

something like

ReDate.getDateFromWeekNumber(~year=2021., ~weekNumber=1., ~weekStartsOn=Friday) 
// would return "2021-01-01T06:00:00.000Z"