by gerjomarty · 2y ago · 0 comments
At the top of the DateTime docs [1]:
> DateTime class is considered deprecated. Use Time class.
The same doc explains when you should use DateTime by using an anecdote about William Shakespeare and Miguel de Cervantes dying on the same day - except they didn't because England and Italy used different calendars at the time. [2]
DateTime is great at dealing with historical pre-1970 dates, otherwise just use Time.
[1]: https://docs.ruby-lang.org/en/3.3/DateTime.html [2]: https://docs.ruby-lang.org/en/3.3/DateTime.html#class-DateTi...