Open complyue opened 3 years ago
Since the Datetime
is YYYY-MM-DD HH-MM-SS, there is no easy way to extract the week of the year. The Time
data type (nanoseconds since the epoch) is considered canonical in this library, and any human-friendly presentation of it should first convert it to some other type and then encode that.
That aside, all the week-of-year stuff is missing because I just never needed it. The API would look something like this:
data YearWeek = YearWeek
{ yearWeekYear :: !Int64
, yearWeekWeek :: !Int -- should be less than 53 (or 54?)
}
timeToYearWeek :: Time -> YearWeek
And then various encodeYearWeek
functions are possible but not necessary. If you or anyone else wants to add this, I'd take a PR.
Sure, I think I'll prepare a PR per my schedule.
Thanks for the information.
I can't find an API to obtain week-of-year from a Datetime, is it intended so or missing by accident?