Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: lib/compiler/implementation/lib/js_helper.dart

Issue 10829102: Create 'unified' version of Date, with a dart2js implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Gramma fix and moved JS logic from DateImplementation to js_helpers. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/lib/coreimpl.dartp ('k') | lib/compiler/implementation/lib/mockimpl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/js_helper.dart
diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart
index c091ce24d3d9badfe1d696dce556fc244cfd4651..afd34a9022e7b516ea255f10e5e7330e92e62f3e 100644
--- a/lib/compiler/implementation/lib/js_helper.dart
+++ b/lib/compiler/implementation/lib/js_helper.dart
@@ -544,9 +544,11 @@ class Primitives {
}
static getWeekday(receiver) {
- return (receiver.isUtc)
+ int weekday = (receiver.isUtc)
? JS('int', @'#.getUTCDay()', lazyAsJsDate(receiver))
: JS('int', @'#.getDay()', lazyAsJsDate(receiver));
+ // Adjust by one because JS weeks start on Sunday.
+ return (weekday + 6) % 7 + 1;
}
static valueFromDateString(str) {
« no previous file with comments | « lib/compiler/implementation/lib/coreimpl.dartp ('k') | lib/compiler/implementation/lib/mockimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698