Code Monkey home page Code Monkey logo

retail-calendar's People

Contributors

abuyukcakir avatar cihancimen avatar daniyalzade avatar dependabot[bot] avatar f avatar mikfreedman avatar oozd avatar yakuza8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

retail-calendar's Issues

LeapYearStrategy.DropFirstWeek is named incorrectly

I expect that the enum LeapYearStrategy.DropFirstWeek drops the first week during 53 week years for comparison purposes.

In fact, this strategy drops the last week, and LeapYearStrategy.Restated drops the first week.

retail leap year for 445 calendar adds a week to the eleventh month

I have a need to provide a different leap year strategy to retail-calendar aside from restated or drop first week.

Naturally, it's hard to find detailed examples of how this works but I managed to find this specification that details what I'm talking about:

Below is an example of the coded $DWMY445 that uses a 4-
4-5 accounting calendar.  The first year starts on
02JAN84 and ends on 30DEC84.  Each week begins on Monday.
The accounting year that has 53 weeks is 1989.  The 11th
month has the extra week in the 53 week year.  The two
years in the sample that begin in the same year as the
accounting year have the starting dates of 02JAN84 and
01JAN90

from: 4.7.2.3 Calendar Modifications for 445/454/544 Calendars

RetailCalendarWeek.weekOfQuarter and RetailCalendarWeek.quarterOfYear is not calculated correctly

With the merging of #22 , I introduced a bug in the calculation of the fields weekOfQuarter and quarterOfYear on RetailCalendarWeek

For the following setup:

    const calendar = new RetailCalendarFactory({
        weekCalculation: WeekCalculation.LastDayNearestEOM,
        weekGrouping: WeekGrouping.Group445,
        lastDayOfWeek: LastDayOfWeek.Friday,
        lastMonthOfYear: LastMonthOfYear.January,
        leapYearStrategy: LeapYearStrategy.AddToPenultimateMonth
      }, 2022)

    const week = calendar.weeks[39]

I expect week.weekOfQuarter to be 0, however I receive 11
I expect week.quarterOfYear to be 4 and I received something else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.