2013-05-29 06:29:30 +08:00
|
|
|
"use strict";
|
2011-07-08 06:15:13 +08:00
|
|
|
var vows = require('vows')
|
|
|
|
, assert = require('assert')
|
|
|
|
, dateFormat = require('../lib/date_format');
|
|
|
|
|
|
|
|
vows.describe('date_format').addBatch({
|
2013-05-29 06:29:30 +08:00
|
|
|
'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'
|
|
|
|
);
|
2011-07-08 06:15:13 +08:00
|
|
|
}
|
2013-05-29 06:29:30 +08:00
|
|
|
}
|
2011-07-08 06:15:13 +08:00
|
|
|
}).export(module);
|