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

next-biz-date

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-biz-date - npm Package Compare versions

Comparing version 0.0.9 to 1.0.0

test/tests.js

26

example-use.js

@@ -1,19 +0,19 @@

const moment = require("moment");
const nbd = require("../next-biz-date");
const holidays = [
"2020-12-17",
"2020-12-25",
"2020-12-28",
"2021-01-01",
"2021-01-04"
"2020-12-17",
"2020-12-25",
"2020-12-28",
"2021-01-01",
"2021-01-04"
];
const initialDate = "2020-12-24";
const offset = 1;
const direction = "FORWARD";
const testCases = [
{initialDate: "2020-12-24", offset: 1, direction: "FORWARD", expected_result: "2020-12-29"},
{initialDate: "2020-12-29", offset: 1, direction: "BACKWARDS", expected_result: "2020-12-24"}
];
const result = nbd.FindNextBizDate(initialDate, holidays, offset, direction);
console.log("RESULT: ", result);
console.log("INPUTS:",{initialDate, offset, direction});
testCases.forEach((item, idx)=>{
console.log(`CASE #${idx}: `,item);
console.log(" RESULT: ", nbd.FindNextBizDate(item.initialDate, holidays, item.offset, item.direction));
});
{
"name": "next-biz-date",
"version": "0.0.9",
"version": "1.0.0",
"description": "returns the next future business date based on a reference date and a number of days to look into the future and given array of holidays",

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

@@ -35,21 +35,21 @@ # next-biz-date

```
const moment = require("moment");
const nbd = require("next-biz-date");
const holidays = [
"2020-12-17",
"2020-12-25",
"2020-12-28",
"2021-01-01",
"2021-01-04"
"2020-12-17",
"2020-12-25",
"2020-12-28",
"2021-01-01",
"2021-01-04"
];
const initialDate = "2020-12-24";
const offset = 1;
const direction = "FORWARD";
const testCases = [
{initialDate: "2020-12-24", offset: 1, direction: "FORWARD", expected_result: "2020-12-29"},
{initialDate: "2020-12-29", offset: 1, direction: "BACKWARDS", expected_result: "2020-12-24"}
];
const result = nbd.FindNextBizDate(initialDate, holidays, offset, direction);
console.log("RESULT: ", result);
console.log("INPUTS:",{initialDate, offset, direction});
testCases.forEach((item, idx)=>{
console.log(`CASE #${idx}: `,item);
console.log(" RESULT: ", nbd.FindNextBizDate(item.initialDate, holidays, item.offset, item.direction));
});
```
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