Thread overview
[Issue 18552] std.datetime.date.Date strips year int argument to short
Mar 04, 2018
Jonathan M Davis
Mar 04, 2018
Jonathan M Davis
Dec 17, 2022
Iain Buclaw
March 04, 2018
https://issues.dlang.org/show_bug.cgi?id=18552

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang@jmdavisProg.co
                   |                            |m

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
What is the use case where this matters?

The various constructors in std.datetime accepts int in order to avoid forcing casts when calling the constructor (especially since when it was first added to Phobos, VRP didn't exist, so passing integer literals to a short was an error even if they fit).

The documenattion makes it pretty clear that Date does not support values beyond what a short can hold, and it would be highly abnormal to pass anything which did not fit in that range. Why should Date care about checking that it isn't given a ridiculous number for the year, especially when the result is still a perfectly valid Date?

--
March 04, 2018
https://issues.dlang.org/show_bug.cgi?id=18552

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement

--
March 04, 2018
https://issues.dlang.org/show_bug.cgi?id=18552

--- Comment #2 from feklushkin.denis@gmail.com ---
> What is the use case where this matters?

RDBMSes (at least Postgres) supports int type of year. With restrictions
associated with Julian day (4713 BC boundary) it can represent up to 294276 AD.

When converting test values to and from Postgres I found mismatch for such big numbers.

> The documenattion makes it pretty clear that Date does not support values beyond what a short can hold

Does not overrides necessity of assert, at least

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18552

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
July 25
https://issues.dlang.org/show_bug.cgi?id=18552

feklushkin.denis@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from feklushkin.denis@gmail.com ---
Fixed in https://github.com/dlang/phobos/pull/9025

--