holonk / retail-calendar Goto Github PK
View Code? Open in Web Editor NEWA configurable merchandising and retail calendar generator.
Home Page: https://toolio.com/retailcalendar
License: MIT License
A configurable merchandising and retail calendar generator.
Home Page: https://toolio.com/retailcalendar
License: MIT License
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
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.
Some calendars I have encountered seem to allow a leap week to be added to an arbitrary month of the year.
For example, the calendar I am currently working with adds a week to the second month of its retail calendar
Use of Moment is discouraged by the project itself https://momentjs.com/docs/#/-project-status/
switching to something like https://date-fns.org/ would reduce package sizes for those using this project.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.