ariebovenberg / whenever

⏰ Sensible and typesafe datetimes for Python
https://whenever.rtfd.io
MIT License
362 stars 7 forks source link

Allow parsing (and representing?) leap seconds #90

Open ariebovenberg opened 3 months ago

ariebovenberg commented 3 months ago

Many standards and libraries allow for times like 23:59:60 to represent leap seconds, whenever should too. (Note that this is not the same as taking into account historical leap seconds, which almost no libraries or standards do)

Two approaches I can think of for this:

  1. Allow 60 seconds when ingesting or parsing data, but constrain it to 59 in the actual class (this is what JS temporal does)
  2. Representing leap seconds by allowing up to 2 seconds of micro/nanoseconds (this is what Chrono does)