Trying to fix spec/javascripts/models/story.spec.js error (red)

4 views
Skip to first unread message

Al

unread,
Dec 11, 2011, 11:30:51 AM12/11/11
to Fulcrum Devel
To go from red to green, I modified spec/javascripts/models/
story.spec.js

SPEC: it("should return a readable created_at", function() {

LINE BEFORE: this.story.set({'created_at': "2011/09/19 02:25:56
+0000"});

Changed
from "expect(this.story.created_at()).toBe("19 Sep 2011, 2:25pm");"
to "expect(this.story.created_at()).toBe("18 Sep 2011, 10:25pm");",

but I do not understand why, so I will not check it in until I do.
I assume it has something to do with default datetime format and
timezones.

Any help would be appreciated.

Steven Talcott Smith

unread,
Jan 9, 2012, 5:47:40 AM1/9/12
to Fulcrum Devel
This is due to the date formatter recognizing +0000 as GMT+0 and then
converting to local time.

I've issued a pull req on issue #80.

Malcolm Locke

unread,
Jan 11, 2012, 3:17:52 AM1/11/12
to fulcru...@googlegroups.com

Thanks for posting this Al. This basically works for me, because 02:25
GMT is equal to 2:25pm NZ time (my time zone).

Looking at it retrospectively, it's not going to work in any other time
zones where 02:25 does not convert to 2:25pm. 100% my bad.

I'll have a look at a way to effectively test the result independent of
the users time zone.

Thanks Al and Steven for taking the time to investigate this.

Malc

Reply all
Reply to author
Forward
0 new messages