Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding information to test, week date test cannot run in some timezones

  • Loading branch information...
commit 718e5870192c841e4e9ab613abd2d5297cc80ccd 1 parent 13fccd4
@paularmstrong authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 tests/filters.test.js
View
14 tests/filters.test.js
@@ -34,12 +34,15 @@ exports.capitalize = function (test) {
test.done();
};
-function makeDate(pstOffset, y, m, d, h, i, s) {
+// Create dates for a particular timezone offset.
+// For example, specifying 480 (offset in minutes) for tzOffset creates a date
+// in your local timezone that is the same date as the specified y,m,d,h,i,s in PST.
+function makeDate(tzOffset, y, m, d, h, i, s) {
var date = new Date(y, m || 0, d || 0, h || 0, i || 0, s || 0),
offset = date.getTimezoneOffset();
- if (offset !== pstOffset) { // timezone offset in PST for september
- date = new Date(date.getTime() - ((offset * 60000) - (pstOffset * 60000)));
+ if (offset !== tzOffset) { // timezone offset in PST for september
+ date = new Date(date.getTime() - ((offset * 60000) - (tzOffset * 60000)));
}
return date;
@@ -65,7 +68,10 @@ exports.date = function (test) {
testFilter(test, 'date("z", 480)', { v: makeDate(480, 2011, 11, 31) }, '364', 'z');
// Week
- testFormat('W', '36');
+ if (date.getTimezoneOffset() > -400) {
+ // guaranteed to fail with the current test date in any timezone offset east of -400
+ testFormat('W', '36');
+ }
// Month
testFormat('F', 'September');
Please sign in to comment.
Something went wrong with that request. Please try again.