Skip to content

Fiscal Calendar Configurable #11

@simeonwillbanks

Description

@simeonwillbanks

Problem

The MerchCalendar gem uses the National Retail Federation (NRF) fiscal calendar which runs from February to January. If a MerchCalendar user has a different fiscal calendar, they must change year values before sending those values to methods such as MerchCalendar.weeks_for_month.

# Our companies' fiscal calendar runs April to March        
START_MONTH_OF_FINANCIAL_YEAR = 4       
# NRF is the National Retail Federation whose fiscal calendar runs February to January      
# The MerchCalendar gem uses the NRF fiscal calendar        
START_MONTH_OF_NRF_YEAR = 2

# gives NRF year for self.year in a given month     
 def nrf_year(month)        
  if month >= START_MONTH_OF_FINANCIAL_YEAR || month < START_MONTH_OF_NRF_YEAR      
    year.to_i - 1       
  else      
    year.to_i       
  end       
end

MerchCalendar.weeks_for_month(nrf_year(2014), 1)

Solution

Allow the fiscal year to be configurable.

Options:

  • Offset the National Retail Federation fiscal calendar
  • Add option for START_MONTH_OF_FINANCIAL_YEAR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions