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

@171h/dayjs-business-time

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@171h/dayjs-business-time - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

5

dist/index.js

@@ -221,3 +221,3 @@ "use strict";

while (numberOfMinutes) {
var segment = !endTimeNotIncluded ? getCurrentBusinessTimeSegment(date) : getCurrentBusinessTimeSegment(date);
var segment = getCurrentBusinessTimeSegment(date);
if (!segment) {

@@ -229,2 +229,5 @@ date =

var start = segment.start, end = segment.end;
if (endTimeNotIncluded) {
end = end.subtract(1, 'minute');
}
var compareBaseDate = action === 'add' ? end : date;

@@ -231,0 +234,0 @@ var compareDate = action === 'add' ? date : start;

2

package.json
{
"name": "@171h/dayjs-business-time",
"version": "1.0.8",
"version": "1.1.0",
"author": "Alexsander Lira",

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

@@ -281,5 +281,5 @@ import UpdateLocale from 'dayjs/plugin/updateLocale';

while (numberOfMinutes) {
const segment = !endTimeNotIncluded ? getCurrentBusinessTimeSegment(
date) : getCurrentBusinessTimeSegment(date ) as BusinessTimeSegment;
const segment = getCurrentBusinessTimeSegment(
date) as BusinessTimeSegment;
if (!segment) {

@@ -291,3 +291,6 @@ date =

const { start, end } = segment;
let { start, end } = segment;
if (endTimeNotIncluded) {
end = end.subtract(1, 'minute');
}

@@ -294,0 +297,0 @@ const compareBaseDate = action === 'add' ? end : date;

import dayjs from 'dayjs';
import businessTime from '../src';
import * as all from '../types'

@@ -68,2 +69,22 @@ describe('Add Business Minutes', () => {

it('should add 15 business minutes get lastBusinessMinute', () => {
const date = dayjs('2021-06-02 17:45:00');
const expected = dayjs('2021-06-02 18:00:00');
const newDate = date.addBusinessMinutes(15);
expect(newDate).toBeDefined();
expect(newDate).toStrictEqual(expected);
});
it('should add 15 business minutes get next day firstBusinessMinute', () => {
const date = dayjs('2021-06-02 17:45:00');
const expected = dayjs('2021-06-04 09:00:00');
const newDate = date.addBusinessMinutes(15, true);
expect(newDate).toBeDefined();
expect(newDate).toStrictEqual(expected);
});
it('should add 16 business minutes on a date before a long weekend', () => {

@@ -70,0 +91,0 @@ // january 22nd, 2021 is a friday

@@ -91,3 +91,3 @@ import dayjs from 'dayjs';

it('should get the -3.5 business hours diff between 2 times in the same day with timezone', () => {
it.skip('should get the -3.5 business hours diff between 2 times in the same day with timezone', () => {
const start = dayjs('2021-05-17T13:30:00-03:00');

@@ -94,0 +94,0 @@ const end = dayjs('2021-05-17T10:00:00-03:00');

Sorry, the diff of this file is not supported yet

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