Comparing version 0.0.1 to 0.0.2
10
index.js
@@ -23,3 +23,3 @@ /** | ||
*/ | ||
module.exports = function(ts){ | ||
module.exports = function(ts) { | ||
var res; | ||
@@ -35,2 +35,10 @@ switch (typeof ts) { | ||
module.exports.tz = (new Date()).getTimezoneOffset() * mult['m']; | ||
Object.defineProperty(module.exports, 'tz', { | ||
writable: false, | ||
enumerable: true, | ||
value: (new Date()).getTimezoneOffset() * mult['m'] | ||
}); | ||
/** | ||
@@ -37,0 +45,0 @@ * Parse the given `str` and return milliseconds. |
{ | ||
"name": "date-ms", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "date string to ms convertion lib", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,5 +0,6 @@ | ||
# date-ms: miliseconds conversion utility | ||
Inspired by [guille/ms.js](https://github.com/guille/ms.js) | ||
date-ms | ||
======= | ||
Milliseconds conversion utility, inspired by [guille/ms.js](https://github.com/guille/ms.js) | ||
## Installation | ||
### Installation | ||
@@ -10,3 +11,3 @@ ``` | ||
## Usage | ||
### Usage | ||
@@ -30,6 +31,8 @@ ```js | ||
ms('Thu May 16 2013 00:47:53 GMT+0400 (MSK)') // 1368650873000 | ||
ms.tz // -14400000 | ||
``` | ||
## License | ||
### License | ||
MIT |
@@ -92,1 +92,24 @@ /** | ||
describe('ms.tz', function() { | ||
beforeEach(function() { | ||
this.tz = (new Date()).getTimezoneOffset() * 1000 * 60; | ||
}); | ||
it('should return timezone offset', function() { | ||
expect( ms.tz ).to.eql( this.tz ); | ||
}); | ||
it('should be enumerable', function() { | ||
expect( ms ).to.have.key( 'tz' ); | ||
}); | ||
it('should not be writable', function() { | ||
ms.tz = 42; | ||
var f = function() { 'use strict'; ms.tz = 42; }; | ||
expect( ms.tz ).to.eql( this.tz ); | ||
expect( f ).to.throwError(); | ||
}); | ||
}); |
5147
134
37