0.0.2 • Published 5 years ago

fiscal-fns v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Fiscal-fns

Build Status Coverage Status

Fiscal-fns is a date-fns like package that provides functions for working with fiscal years.

Install

npm install --save fiscal-fns

Usage

Options

All functions take an options object which looks like this:

{
  startMonth: 3, // The month your fiscal year starts in. Be aware this is 0-indexed so 0 = january 11 = decemeber.
  startDay: 1 // The date in the month your year starts on.
}

endOfFiscalYear

ParameterDefaultDescription
date-The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
options{startDay: 1, startMonth: 3}See Options above.

fiscalYear

ParameterDefaultDescription
year-The year to return the start/end of. 2018 will return 1st April 2018 for the start and 31st March 2019 for the end.
options{startDay: 1, startMonth: 3}See Options above.

inFiscalYear

ParameterDefaultDescription
date-The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
startDate-The start of the fiscal year to test.
options{startDay: 1, startMonth: 3}See Options above.

startOfFiscalYear

ParameterDefaultDescription
date-The date to test, can be either a string or a Date. It is passed to date-fns internally so anything date-fns can parse can be used here.
options{startDay: 1, startMonth: 3}See Options above.