Use Date.getTime instead of Date.getMilliseconds in dart:js.

BUG= http://dartbug.com/14915
R=kasperl@google.com

Review URL: https://codereview.chromium.org//180723004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33116 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
floitsch@google.com 2014-02-27 15:13:44 +00:00
parent 5bb99a34a6
commit 842be2c90d
3 changed files with 20 additions and 1 deletions

View file

@ -534,7 +534,7 @@ Object _convertToDart(o) {
// long line: dart2js doesn't allow string concatenation in the JS() form
return JS('Blob|Event|KeyRange|ImageData|Node|TypedData|Window', '#', o);
} else if (JS('bool', '# instanceof Date', o)) {
var ms = JS('num', '#.getMilliseconds()', o);
var ms = JS('num', '#.getTime()', o);
return new DateTime.fromMillisecondsSinceEpoch(ms);
} else if (JS('bool', '#.constructor === #', o, _dartProxyCtor)) {
return JS('', '#.o', o);

View file

@ -0,0 +1,14 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:js';
import 'package:expect/expect.dart';
main() {
var dt = new DateTime.now();
var jsArray = new JsObject.jsify([dt]);
var roundTripped = jsArray[0];
Expect.isTrue(roundTripped is DateTime);
Expect.equals(dt.millisecondsSinceEpoch, roundTripped.millisecondsSinceEpoch);
}

View file

@ -175,6 +175,11 @@ mirrors/globalized_closures2_test/00: RuntimeError # Issue 17118. Please remove
async/timer_not_available_test: Fail, OK # only meant to test when there is no way to
# implement timer (currently only in d8)
# 'js' tests import the dart:js library, so they only make sense in
# a browser environment.
[ $runtime == vm ]
js/*: Skip
[ $compiler == dart2js && $minified ]
mirrors/intercepted_superclass_test: RuntimeError # Issue 16804
mirrors/null_test/00: RuntimeError # Issue 16804. Please remove the multi-test comments when this test starts succeeding.