Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

moment-business-time

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-business-time - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

10

lib/business-hours.js

@@ -232,2 +232,3 @@ var moment = require('moment'),

// ensure `from` is always before `to`
var from, to, diff = 0, multiplier = 1;

@@ -243,2 +244,3 @@ if (this.isAfter(comparator)) {

// normalise to nearest working times
if (!from.isWorkingTime()) {

@@ -251,2 +253,8 @@ from = from.nextWorkingTime();

// if `from` is now after `to` then we have two timestamps on the same night, so diff is zero
if (from.isAfter(to)) {
return 0;
}
// iterate to the same day
while(from.format('L') !== to.format('L')) {

@@ -266,3 +274,3 @@ if (unit === 'day') {

console.warn('WARNING: passing `true` as a third argument to `workingDiff` may lead to ambiguous results');
console.warn('See https://github.com/lennym/moment-business-time/issues/12#issuecomment-199710566')
console.warn('See https://github.com/lennym/moment-business-time/issues/12#issuecomment-199710566');
var hours = from.diff(to, 'hour', true),

@@ -269,0 +277,0 @@ denominator = comparator.isWorkingDay() ? comparator : comparator.nextWorkingDay(),

2

package.json
{
"name": "moment-business-time",
"version": "0.6.0",
"version": "0.6.1",
"description": "Query and manipulate moment objects within the context of business/working hours",

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

@@ -444,2 +444,6 @@ var moment = require('../lib/business-hours');

it('returns zero for times on the same night over consecutive days', function () {
moment('2016-10-16T18:00:00+00:00').workingDiff('2016-10-17T06:00:00+00:00', 'hours').should.equal(0);
});
});

@@ -446,0 +450,0 @@

Sorry, the diff of this file is not supported yet

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