Socket
Socket
Sign inDemoInstall

days360

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    days360

Calculate the difference between two dates based on the 360 day financial year


Version published
Weekly downloads
955
increased by10.28%
Maintainers
1
Install size
129 kB
Created
Weekly downloads
 

Changelog

Source

2.0.0 (2018-08-28)

  • Updated minimum Node.js version to 8
  • Switch to CircleCI 2.0
  • Added Codacy badge

Readme

Source

days360

CircleCI Codacy Badge

Calculate the difference between two dates based on the 360 day financial year, using the US/NASD method (30US/360) or European method (30E/360).

Excel's implementation of the US/NASD method has an incorrect implementation. This library provides an Excel compatible US/NASD method.

Usage

const days360 = require('days360');

days360(new Date('2016-01-01'), new Date('2016-12-31')); // returns 360

Arguments

  • startDate: Start date, as a date or milliseconds since Unix epoch
  • endDate: End date, as a Date or milliseconds since Unix epoch
  • method: An optional argument to specify the calculation
    • days360.US (0): calculate using the US/NASD method, with Excel compatibility
    • days360.EU (1): calculate using the European method
    • days360.US_NASD (2): calculate using the US/NASD method

Testing

Tests require Mocha and can be run with npm test (or yarn test). You can specify Mocha options, such as the reporter, by adding a mocha.opts file to the test directory.

Running npm run test:coverage will generate code coverage reports with Istanbul. The code coverage reports will be located in the coverage directory, which is excluded from the repository.

Keywords

FAQs

Last updated on 28 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc