Skip to content

Date.difference() fails on dart2js in checked mode #4437

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

Closed
alan-knight opened this issue Aug 9, 2012 · 5 comments
Closed

Date.difference() fails on dart2js in checked mode #4437

alan-knight opened this issue Aug 9, 2012 · 5 comments
Assignees
Labels
closed-duplicate Closed in favor of an existing report P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js

Comments

@alan-knight
Copy link
Contributor

The Date.difference() operation fails in dart2js in checked mode. e.g.

main() {
  var localDate = new Date(2012,8,9,10,30,23,0,false);
  var utcDate = new Date(2012,8,9,10,30,23,0,true);
  var x = localDate.difference(utcDate);
  print(x);
}

 ~/dart-repo/dart/out/ReleaseIA32/d8 out.js
out.js:388: 1344533423000 does not implement int
  throw $.captureStackTrace($.TypeError$($.S(value) + ' does not implement int
          ^
1344533423000 does not implement int
    at [object Object].captureStackTrace (out.js:599:18)
    at [object Object].intTypeCheck (out.js:388:11)
    at DateImplementation.difference$1 (out.js:32:56)
    at [object Object].main (out.js:920:67)
    at out.js:1017:5

@gramster
Copy link

I reproed this too. You can just use:

var d = new Date.now();
e = d.difference(d);

Currently I am blocked on changes to the unit test library because of this.


Removed Priority-Medium label.
Added Priority-Critical label.

@kasperl
Copy link

kasperl commented Aug 21, 2012

I guess you can work around the issue by not using checked mode when compiling to JavaScript using dart2js? I'll work on a fix.


Set owner to @kasperl.
Removed Priority-Critical label.
Added Priority-High, Accepted labels.

@gramster
Copy link

Hi Kasper, any progress on this issue?

@floitschG
Copy link
Contributor

The date.valueOf returns an integer outside the 32 bit range which (currently) says that it is not an integer.


Added Duplicate label.
Marked as being merged into #3720.

@kasperl
Copy link

kasperl commented Sep 7, 2012

PSA: I think Nicolas just fixed this in r12018.


Marked as being merged into #3720.

@alan-knight alan-knight added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js closed-duplicate Closed in favor of an existing report labels Sep 7, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants