bitwalker / bitwalker/timex

Error handling conversions which land in a > 4 digit year

Open
#737 2 comments 0 reactions 0 assignees View on GitHub
third party issue
Dominant language
Elixir
Stars
1.8k
Forks
407
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

- `Timex.to_datetime(~N[9999-12-31T23:59:59], "Europe/Amsterdam")`

### Description of issue

On one project im working on uses Timex version '3.6.4' and on another project I use the latest version '3.7.9'. On '3.6.4' this returns `#DateTime<9999-12-31 23:59:59+01:00 CET Europe/Amsterdam>` and on '3.7.9' this raises with

```
** (ArgumentError) cannot convert {{10000, 3, 26}, {2, 0, 0}} to naive datetime, reason: :invalid_date
(elixir 1.13.1) lib/calendar/naive_datetime.ex:839: NaiveDateTime.from_erl!/3
(tzdata 1.1.1) lib/tzdata/time_zone_database.ex:101: Tzdata.TimeZoneDatabase.old_tz_period_to_new/1
(tzdata 1.1.1) lib/tzdata/time_zone_database.ex:34: Tzdata.TimeZoneDatabase.time_zone_periods_from_wall_datetime/2
(timex 3.7.9) lib/timezone/database.ex:37: Timex.Timezone.Database.time_zone_periods_from_wall_datetime/2
(elixir 1.13.1) lib/calendar/datetime.ex:491: DateTime.from_naive/3
(timex 3.7.9) lib/timezone/timezone.ex:573: Timex.Timezone.convert/2
(timex 3.7.9) lib/datetime/naivedatetime.ex:35: Timex.Protocol.NaiveDateTime.to_datetime/2
```

Is this a known issue?

Edit: Did some more digging and "Europe/Athens" has this issue as well but "Europe/Istanbul" doesnt (they are in the same timezone +3:00). Maybe something with daylight savings?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.