Closed chriseyre2000 closed 2 years ago
Timex.parse!("2022-10-29 09:17:42.642885+01:00 BST Europe/London", "{ISO:Extended}") |> Timex.Timezone.convert("Europe/London") |> Timex.shift(hours: -8) |> Timex.shift(days: 1) |> Timex.beginning_of_day()
This returns:
** (Timex.ConvertError) unable to convert value, insufficient date/time information (timex 3.7.9) lib/datetime/map.ex:41: Timex.Protocol.Map.beginning_of_day/1
We actually used Timex.now("Europe/London"), but the above recreates the issue
I expected it to return the start of the day as would have happened an hour later.
Timex.parse!("2022-10-29 09:17:42.642885+01:00 BST Europe/London", "{ISO:Extended}") |> Timex.Timezone.convert("Europe/London") |> Timex.shift(hours: -7) |> Timex.shift(days: 1) |> Timex.beginning_of_day()
The values for -7 and -9 are correct, it only fails for -8
I had failed to handle AmbiguousDateTime.
Steps to reproduce
Timex.parse!("2022-10-29 09:17:42.642885+01:00 BST Europe/London", "{ISO:Extended}") |> Timex.Timezone.convert("Europe/London") |> Timex.shift(hours: -8) |> Timex.shift(days: 1) |> Timex.beginning_of_day()
This returns:
** (Timex.ConvertError) unable to convert value, insufficient date/time information (timex 3.7.9) lib/datetime/map.ex:41: Timex.Protocol.Map.beginning_of_day/1
We actually used Timex.now("Europe/London"), but the above recreates the issue
Description of issue
I expected it to return the start of the day as would have happened an hour later.
DateTime<2022-10-30 00:00:00.000000+01:00 BST Europe/London>
Timex.parse!("2022-10-29 09:17:42.642885+01:00 BST Europe/London", "{ISO:Extended}") |> Timex.Timezone.convert("Europe/London") |> Timex.shift(hours: -7) |> Timex.shift(days: 1) |> Timex.beginning_of_day()
DateTime<2022-10-30 00:00:00.000000+01:00 BST Europe/London>
The values for -7 and -9 are correct, it only fails for -8