removed the extensions to Date, put them in their own library

This commit is contained in:
Gareth Jones
2011-07-08 08:15:13 +10:00
parent 8eaff77974
commit 8767cda15f
2 changed files with 83 additions and 0 deletions

23
test/date_format.js Normal file
View File

@@ -0,0 +1,23 @@
var vows = require('vows')
, assert = require('assert')
, dateFormat = require('../lib/date_format');
vows.describe('date_format').addBatch({
'Date extensions': {
topic: function() {
return new Date(2010, 0, 11, 14, 31, 30, 5);
},
'should format a date as string using a pattern': function(date) {
assert.equal(
dateFormat.asString(dateFormat.DATETIME_FORMAT, date),
"11 01 2010 14:31:30.005"
);
},
'should default to the ISO8601 format': function(date) {
assert.equal(
dateFormat.asString(date),
'2010-01-11 14:31:30.005'
);
}
}
}).export(module);