Comparing version 0.0.15 to 0.0.16
@@ -78,11 +78,11 @@ /** | ||
e: function(now){ var tz = tzInfo(now); return (_isGmt ? 'UTC' : tz.tzname); }, | ||
e: function(now){ var tz = tzInfo(now); return (_isGmt ? 'GMT' : tz.tzname); }, | ||
I: function(now){ var tz = tzInfo(now); return (_isGmt ? 0 : tz.isDst ? 1 : 0); }, | ||
O: function(now){ var tz = tzInfo(now); return (_isGmt ? '+0000' : tz.sign + pad2(tz.h) + pad2(tz.m)); }, | ||
P: function(now){ var tz = tzInfo(now); return (_isGmt ? '+00:00' : tz.sign + pad2(tz.h) + ":" + pad2(tz.m)); }, | ||
T: function(now){ var tz = tzInfo(now); return (_isGmt ? 'UTC' : tz.tz); }, | ||
T: function(now){ var tz = tzInfo(now); return (_isGmt ? 'GMT' : tz.tz); }, | ||
Z: function(now){ var tz = tzInfo(now); return (_isGmt ? 0 : -tz.offs * 60); }, | ||
c: function(now){ var tz = tzInfo(now); return phpdate("Y-m-d\\TH:i:s+00:00", now); }, | ||
r: function(now){ var tz = tzInfo(now); return (_isGmt ? gmdate : phpdate)("D, d M Y H:i:s +0000", now); }, | ||
c: function(now){ var tz = tzInfo(now); return phpdate("Y-m-d\\TH:i:sP", now); }, | ||
r: function(now){ var tz = tzInfo(now); return (_isGmt ? gmdate : phpdate)("D, d M Y H:i:s O", now); }, | ||
U: function(now){ return Math.floor(now.getTime() / 1000); }, | ||
@@ -116,3 +116,3 @@ }; | ||
var tzMap = { | ||
'0': ['UTC', 'UTC', 'UTC'], | ||
'0': ['GMT', 'GMT', 'GMT'], | ||
'240': ['AST', 'ADT', 'Atlantic'], | ||
@@ -251,5 +251,7 @@ '300': ['EST', 'EDT', 'US/Eastern'], | ||
console.log(phpdate("c.u T")); | ||
console.log(gmdate("c.u T")); | ||
console.log(phpdate("c.u T")); | ||
console.log(phpdate("c T")); | ||
console.log(gmdate("c T")); | ||
console.log(phpdate("c T")); | ||
console.log(phpdate("r T")); | ||
//console.log(gmdate("r T")); | ||
@@ -256,0 +258,0 @@ var s; |
{ | ||
"name": "arlib", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Andras' Utility Functions", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -6,11 +6,31 @@ phpdate = require('../index').phpdate; | ||
this.now = Date.now(); | ||
this.timestamp = 315682496123; // 1980-01-02 12:34:56.123000 | ||
done(); | ||
}, | ||
'should return the year': function(t) { | ||
var str = phpdate('Y', 86400000); | ||
t.equal('1970', str); | ||
'should report on timestamp number': function(t) { | ||
var str = phpdate('Y-m-d', 86400000/2); | ||
t.equal('1970-01-01', str); | ||
t.done(); | ||
}, | ||
'should report on timestamp object': function(t) { | ||
var str = phpdate('Y-m-d', new Date(86400000/2)); | ||
t.equal('1970-01-01', str); | ||
t.done(); | ||
}, | ||
'should format Y-m-d H:i:s.u': function(t) { | ||
var str = phpdate('Y-m-d H:i:s.u', 315682496123); | ||
t.equal('1980-01-02 12:34:56.123000', str); | ||
t.done(); | ||
}, | ||
'should format c': function(t) { | ||
var str = phpdate('c', 315682496123); | ||
t.equal('1980-01-02T12:34:56-05:00', str); | ||
t.done(); | ||
}, | ||
// TODO: lots more tests | ||
}; |
46167
1055