Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime constructor needs to specify what ranges it accepts for its arguments. #8808

Open
floitschG opened this issue Feb 26, 2013 · 7 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-a library-core P2 A bug or feature request we're likely to work on type-documentation A request to add or improve documentation

Comments

@floitschG
Copy link
Contributor

DateTime constructor needs to specify what ranges it accepts for its arguments.

Currently dart2js and dart-vm disagree on the year argument.
LibTest/core/Date/year_A01_t01

@DartBot
Copy link

DartBot commented Apr 25, 2013

This comment was originally written by alexe.kaigorodov@gmail.com


sdk-dart acceptes new DateTime(275760), but rejects new DateTime(275761) with "Illegal argument" exception. Nothing is said of this restriction in the spec.

@ghost
Copy link

ghost commented Aug 20, 2013

cc @lrhn.

@floitschG
Copy link
Contributor Author

The DateTime class currently provides the following documentation:
===
It can represent time values that are at a distance of at most 8,640,000,000,000,000ms (100,000,000 days) from epoch (1970-01-01 UTC). In other words: millisecondsSinceEpoch.abs() <= 8640000000000000.
===

We still need to specify how mixed-signed arguments are treated: new DateTime(275765, -12 * 6) is in the valid range, but in order to compute the range we are leaving the "safe" integer range (since these could overflow in JS).

Note that these values are timezone independent. A test that does new DateTime(MAX_YEAR, MAX_MONTH, ...) is therefore likely to be flaky depending on the timezone. new DateTime.utc(MAX_YEAR, ...) should, however, have consistent behavior across the VM and dart2js.

@lrhn
Copy link
Member

lrhn commented Apr 25, 2014

Added Library-Core label.

@sgjesse
Copy link
Contributor

sgjesse commented Apr 30, 2014

Removed Type-Defect label.
Added Type-Documentation label.

@kwalrath
Copy link
Contributor

Added Docs-API label.

@kwalrath
Copy link
Contributor

kwalrath commented Jun 6, 2014

Removed Docs-API label.

@floitschG floitschG added type-documentation A request to add or improve documentation Priority-Medium area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core labels Jun 6, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on and removed triaged labels Feb 29, 2016
@lrhn lrhn added the core-a label Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-a library-core P2 A bug or feature request we're likely to work on type-documentation A request to add or improve documentation
Projects
None yet
Development

No branches or pull requests

6 participants