Open
Description
In the example below, getting a week number using Monday as the start of the week works correctly: today, May 1st, is a new week. But if I try it with the week starting on a Sunday, it's actually identifying Saturday April 29th as the start of this week, when it should be April 30th. Here is the output for the last 4 days, Friday through Monday:
iex(54)> [~D(2023-04-28), ~D(2023-04-29), ~D(2023-04-30), ~D(2023-05-01)] |> Enum.map(&Timex.format!(&1, "%W", :strftime))
["17", "17", "17", "18"]
iex(55)> [~D(2023-04-28), ~D(2023-04-29), ~D(2023-04-30), ~D(2023-05-01)] |> Enum.map(&Timex.format!(&1, "%U", :strftime))
["16", "17", "17", "17"]
iex(56)> [~D(2023-04-28), ~D(2023-04-29), ~D(2023-04-30), ~D(2023-05-01)] |> Enum.map(&Timex.format!(&1, "{Wmon}"))
["17", "17", "17", "18"]
iex(57)> [~D(2023-04-28), ~D(2023-04-29), ~D(2023-04-30), ~D(2023-05-01)] |> Enum.map(&Timex.format!(&1, "{Wsun}"))
["16", "17", "17", "17"]
Metadata
Metadata
Assignees
Labels
No labels