sproutcore 1.4.0.rc.3 → 1.4.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 4
4
- :patch: 0.rc.3
4
+ :patch: 0.rc.4
5
5
  :digest: e038ba5746bb757cd0ff2391828c5f03496fbb64
6
6
  :dist:
7
7
  frameworks/sproutcore: 7174adeb47aa0930c95ddae79e2c9cf042fded45
@@ -210,8 +210,13 @@ test("writing a string to a number attribute should store a number" ,function()
210
210
 
211
211
  test("writing a date should generate an ISO date" ,function() {
212
212
  var date = new Date(1238650083966);
213
- equals(rec.set('date', date), rec, 'returns reciever');
214
- equals(rec.readAttribute('date'), '2009-04-01T22:28:03-07:00', 'should have new time (%@)'.fmt(date.toString()));
213
+
214
+ // Work with timezones
215
+ var utcDate = new Date(Number(date) + (date.getTimezoneOffset() * 60000)); // Adjust for timezone offset
216
+ utcDate.getTimezoneOffset = function(){ return 0; }; // Hack the offset to respond 0
217
+
218
+ equals(rec.set('date', utcDate), rec, 'returns reciever');
219
+ equals(rec.readAttribute('date'), '2009-04-02T05:28:03Z', 'should have time in ISO format');
215
220
  });
216
221
 
217
222
  test("writing an attribute should make relationship aggregate dirty" ,function() {
@@ -9,15 +9,18 @@
9
9
  module("SC.Validator.Date");
10
10
 
11
11
  test("Converts into date if a value is given",function(){
12
-
13
- var num = 1234947136000; // represents time in secs
14
- var c = SC.Validator.Date.fieldValueForObject(1234947136000,'','');
15
- equals(YES,c === "Feb 18, 2009 12:52:16 AM","Number converted to date format");
12
+ var date = new Date(1234947136000),
13
+ utcDate = new Date(Number(date) + (date.getTimezoneOffset() * 60000)); // Adjust for timezone offset
14
+
15
+ var c = SC.Validator.Date.fieldValueForObject(Number(utcDate),'','');
16
+ var expected = "Feb 18, 2009 8:52:16 AM";
17
+ ok(c === expected, "Number converted to date format. Expected: (%@) but got (%@)".fmt(expected, c));
16
18
  });
17
19
 
18
20
  test("Converts into number when date string is given", function(){
19
- var da = "Feb 18, 2009 12:52:16 AM"; // date string
20
- var d = SC.Validator.Date.objectForFieldValue("Feb 18, 2009 12:52:16 AM",'','');
21
- equals(YES,d === 1234947136000,"Date String compared with value in seconds");
22
- equals(YES,SC.typeOf(d) == "number","Number is obtained");
23
- });
21
+ var expected = 1234918336000;
22
+ var date = new Date(expected);
23
+ var d = SC.Validator.Date.objectForFieldValue(date.format('NNN d, yyyy h:mm:ss a'),'','');
24
+ ok(d === expected, "Date String compared with value in seconds. Expected: (%@) but got (%@)".fmt(expected, d));
25
+ ok(SC.typeOf(d) == "number", "Number is obtained");
26
+ });
@@ -175,7 +175,7 @@ test("Multiple arguments", function() {
175
175
  SC.guidFor(obj1),
176
176
  obj2.hash(),
177
177
  SC.guidFor(str),
178
- SC.guidFor(str)
178
+ SC.guidFor(arr)
179
179
  ].join('');
180
180
 
181
181
  equals(h, SC.hashFor(obj1, obj2, str, arr), "hashFor should concatenate the arguments' hashes when there are more than one");
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 4
8
8
  - 0
9
9
  - rc
10
- - 3
11
- version: 1.4.0.rc.3
10
+ - 4
11
+ version: 1.4.0.rc.4
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sprout Systems, Inc. Apple Inc. and contributors