项目作者: Antoine-Mace

项目描述 :
Fiscal tax year calculator, retrieve the tax-year, month and week for a given date. Start date of the financial year is editable.
高级语言: JavaScript
项目地址: git://github.com/Antoine-Mace/tax-year.git
创建时间: 2018-05-02T15:55:46Z
项目社区:https://github.com/Antoine-Mace/tax-year

开源协议:MIT License

下载


Download

Tax Year

Fiscal tax year calculator, retrieve the tax-year, month and week for a given date.

Quick start

Install onto your node project using yarn or npm:

  1. yarn add tax-year
  1. npm install tax-year

To use:

  1. 'use strict'
  2. const taxYear = require('tax-year')
  3. const today = new Date()
  4. const calculator = taxYear()
  5. function runCalendarTest() {
  6. let computeDate = today;
  7. let days = 1;
  8. console.log("\nTest 3/3: Uk, 1 year")
  9. while (days != 365) {
  10. let result = calculator.getTaxYear(computeDate);
  11. console.log(`\n${days + 1}/365`)
  12. console.log("Result:", result)
  13. computeDate.setDate(computeDate.getDate() + 1);
  14. days++;
  15. }
  16. }
  17. function runTest() {
  18. console.log("Test 1/3: Irish, financial year start")
  19. console.log("Result:", calculator.getTaxYear(today, {
  20. day: 1,
  21. month: 1
  22. }))
  23. console.log("\nTest 2/3: Uk, financial year start")
  24. calculator.setFYS({
  25. day: 6,
  26. month: 4
  27. })
  28. console.log("Result:", calculator.getTaxYear(today))
  29. runCalendarTest(calculator)
  30. }
  31. runTest()

Test

  1. yarn test
  1. npm run test

License

This project is MIT licensed. By contributing you agree that your contributions will be licensed under its
MIT license.