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.2 to 0.7.0

16

lib/business-hours.js

@@ -101,5 +101,13 @@ var moment = require('moment'),

function add(d, num, unit) {
if(num < 0){
return subtract(d, -(num), unit);
}
unit = moment.normalizeUnits(unit);
if (unit === 'day') {
if (unit === 'day' ) {
d = incrementDays('add')(num, d);

@@ -113,2 +121,6 @@ } else if (unit) {

function subtract(d, num, unit) {
if(num < 0){
return add(d, -(num), unit);
}
unit = moment.normalizeUnits(unit);

@@ -161,3 +173,3 @@ if (unit === 'day') {

} else {
return this.isAfter(openinghours[0]) && this.isBefore(openinghours[1]);
return this.isSameOrAfter(openinghours[0]) && this.isSameOrBefore(openinghours[1]);
}

@@ -164,0 +176,0 @@ };

2

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

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

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

it('considers working time inclusive', function(){
moment.locale('en', {
workinghours: {
0: null,
1: ['09:00:00', '17:00:00'],
2: ['09:00:00', '17:00:00'],
3: ['09:00:00', '17:00:00'],
4: ['09:00:00', '17:00:00'],
5: ['09:00:00', '17:00:00'],
6: null
}
});
moment('2017-06-26 9:00:00').isWorkingTime().should.be.true;
moment('2017-06-26 17:00:00').isWorkingTime().should.be.true;
});
});

@@ -94,2 +111,10 @@

it('can add negative days', function(){
moment(now).addWorkingTime(-1, 'day').format(date).should.equal('2015-02-25');
});
});

@@ -220,2 +245,6 @@

it('can subtract negative days', function(){
moment(now).subtractWorkingTime(-2, 'day').format(date).should.equal('2015-03-02');
});
});

@@ -222,0 +251,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