Skip to content

Commit

Permalink
utc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewplummer committed Sep 6, 2012
1 parent 441fa0f commit 755c1f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,16 @@
return createDate(arguments);
},

/***
* @method Date.createUTC(<d>, [locale] = currentLocale)
* @returns Date
* @short Date constructor identical to %create%, but which takes <d> to be a UTC based time.
* @example
*
* Date.createUTC('September 17th, 2012') -> September 17th, 2012 (UTC)
* Date.createUTC('5:00am') -> 5:00am (UTC)
*
***/
'createUTC': function() {
return createDate(arguments, true);
},
Expand Down
6 changes: 5 additions & 1 deletion unit_tests/environments/sugar/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -2493,11 +2493,15 @@ test('Date', function () {
equal(Date.createUTC('2001-01-15').format('{tz}'), '+0000', 'Date#format | UTC date will have +0000 offset');


equal(Date.createUTC(2000, 0).utc().isLeapYear(), true, 'Date#isLeapYear | accounts for utc dates');
equal(Date.createUTC(2000, 0).isLeapYear(), true, 'Date#isLeapYear | accounts for utc dates');
equal(Date.createUTC(2000, 1, 14).utc().is('Monday'), true, 'Date#is | should handle utc dates');

equal(Date.createUTC(2000, 1, 14).format(), 'February 14, 2000 12:00am', 'Date#format | from UTC time');


d = new Date(2001, 5, 15);

var hours = d.getHours() - (d.getTimezoneOffset() / 60);



Expand Down

0 comments on commit 755c1f1

Please sign in to comment.