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

instadate

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instadate - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

8

instadate.js

@@ -31,2 +31,6 @@ var difference = require('lodash.difference');

differenceInDates: function (d1, d2) {
return trunc((utcDate(d2) - utcDate(d1)) / constants.MS_IN_DAY);
},
differenceInDays: function (d1, d2) {

@@ -256,2 +260,6 @@ return trunc((utc(d2) - utc(d1)) / constants.MS_IN_DAY);

function utcDate(d) {
return Date.UTC(d.getFullYear(), d.getMonth(), d.getDate());
}
function isBetween(d, start, end, beforeFn, afterFn) {

@@ -258,0 +266,0 @@ if (start > end) {

2

package.json
{
"name": "instadate",
"version": "0.1.3",
"version": "0.1.4",
"description": "",

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

@@ -19,3 +19,2 @@ # Instadate

* is **small** (just look at the source)
* does **not** care about **timezones** (use moment instead)
* is **immutable** (Instadate will always return new date objects and never modify the given ones)

@@ -27,1 +26,26 @@

```
**NB! Documentation is a WIP, look at source for all functions**
## API Reference
### `instadate.utc(date)`
Returns the UTC time in milliseconds.
### `instadate.noon(date)`
Returns a copy of the date with hours set to 12 and minutes, seconds and milliseconds set to 0.
### `instadate.differenceInDays(from, to)`
Returns the difference in days (24 hour periods) between two dates. Returned result can be negative.
### `instadate.differenceInHours(from, to)`
Returns the difference in hours (60 minute periods) between two dates. Returned result can be negative.
### `instadate.differenceInDays(from, to)`
Returns the difference in days (24 hour periods) between two dates. Returned result can be negative.
### `instadate.differenceInWeekendDays(from, to)`
Returns the difference in days (24 hour periods) between two dates. Excludes weekend days. Returned result can be negative.
### `instadate.differenceInWorkDays(from, to)`
Returns the difference in days (24 hour periods) between two dates. Excludes weekend days. Returned result can be negative.

@@ -76,2 +76,10 @@ var test = require('tape');

test('differenceInDates', function (t) {
var d = new Date('Mon Jan 18 2016 23:07:17 GMT+0200 (EET)');
t.equal(instadate.differenceInDates(d, d), 0);
t.equal(instadate.differenceInDates(d, instadate.addHours(d, 1)), 1);
t.equal(instadate.differenceInDates(d, instadate.addHours(d, -24)), -1);
t.end();
});
test('differenceInDays', function (t) {

@@ -78,0 +86,0 @@ var d = new Date('Mon Jan 18 2016 13:07:17 GMT+0200 (EET)');

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