New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

date-ms

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-ms - npm Package Compare versions

Comparing version 0.0.3 to 0.0.5

bower.json

25

index.js

@@ -0,1 +1,2 @@

;(function(root) {
/**

@@ -23,3 +24,3 @@ * Helpers.

*/
module.exports = function(ts) {
var ms = function(ts) {
switch (ts) {

@@ -38,5 +39,5 @@ case '':

module.exports.tz = (new Date()).getTimezoneOffset() * mult['m'];
ms.tz = (new Date()).getTimezoneOffset() * mult['m'];
Object.defineProperty(module.exports, 'tz', {
Object.defineProperty(ms, 'tz', {
writable: false,

@@ -48,2 +49,12 @@ enumerable: true,

/**
* Start of day (in user's timezone)
*
* @param {String|Number|Date} date
* @returns Number
*/
ms.sod = function(date) {
return Math.floor( ms(date) / mult['d'] ) * mult['d'] + ms.tz;
};
/**
* Parse the given `str` and return milliseconds.

@@ -61,1 +72,9 @@ *

}
if (typeof module === 'object' && module.exports) {
module.exports = ms;
} else {
this.ms = ms;
}
})(this);

2

package.json
{
"name": "date-ms",
"version": "0.0.3",
"version": "0.0.5",
"description": "date string to ms convertion lib",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,4 +0,2 @@

[![build status](https://secure.travis-ci.org/artjock/date-ms.png)](http://travis-ci.org/artjock/date-ms)
date-ms
date-ms [![build status](https://secure.travis-ci.org/artjock/date-ms.png)](http://travis-ci.org/artjock/date-ms)
=======

@@ -12,2 +10,5 @@ Milliseconds conversion utility, inspired by [guille/ms.js](https://github.com/guille/ms.js)

```
```
bower install date-ms
```

@@ -38,2 +39,5 @@ ### Usage

ms.tz // -14400000
// start of day in user's timezone
ms.sod('2013-06-17T12:02:40+0400') // +new Date('2013-06-17T00:00:00+0400')
```

@@ -40,0 +44,0 @@

@@ -129,1 +129,14 @@ /**

});
describe('sod', function() {
it('should return start of day', function() {
expect( ms.sod('Mon Jun 17 2013 15:57:49 GMT+0400 (MSK)') )
.to.eql( +new Date('Mon Jun 17 2013 00:00:00 GMT+0400 (MSK)') );
});
it('should should return NaN for unparsed value', function() {
expect( Number.isNaN( ms.sod('foo') ) ).to.be.ok();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc