Code Monkey home page Code Monkey logo

calendars's Introduction

calendars

Utility classes for the following calendars with tests:

  1. Regular solar calendar
  2. Fiscal calendar, based on class constant FISCAL_START.
  3. Retail calendar, based on class constant FISCAL_START.
  4. ISO calendar, based on Python's datetime module.
  5. Lunisolar calendar, based on PyCalCal module.

Using these utility classes, one can quickly determine, for example, quarter or month number of a given date with respect to, for example, the ISO or retail calendar. This module can be helpful since planning in businesses (small or large) is mostly based on one of those calendars (fiscal/ISO/retail).

Additional information

There are surprisingly many types of calendar. Some of them are:

  1. Regular (Gregorian) Calendar: regular solar calendar date range as we know.
    • Example: January 01, 2006 to December 31, 2006.
  2. Lunar Calendar: based on cycles of the lunar phases.
    • Example: January 29, 2006 to February 17, 2007.
    • A lunar year is defined as 12 lunations (months), which is about 354 days.
    • Each month is either 29 or 30 days long. The length of each month changes from year to year, unlike the Gregorian calendar.
    • In every two or three years, a thirteenth-month (intercalary month or leap month) is added to bring the calendar year into synchronisation with the solar year.
  3. Fiscal Calendar: a company’s selected calendar date range for required SEC financial statement filing.
    • Example: August 01, 2005 to July 31, 2006 is my company's fiscal year 2006.
  4. Tax Calendar: A number sequence representing weeks in a Tax year which begins right after the US Tax Day.
    • Example: April 16, 2005 to April 15, 2006.
  5. Retail Calendar: also known as 4-4-5 Calendar or 544 calendar. 544 describes the number of weeks for months in a given quarter. Each quarter begins with a 5 week "month", followed by 2 four week "months".
    • Example: July 31, 2005 to July 29, 2006.
    • Why? This calendar ensures all 4 quarters in a calendar year are equal. This allows comparing weekly data (e.g., retail sales) to the prior year without correcting for times when regular calendar weeks break across months or quarters.
    • How? It usually uses the same end month as the fiscal calendar and each retail week consists of Sunday through Saturday.
      • The retail year end is defined as "the last Saturday of the month at the fiscal year end".
      • If August 1st is Sunday, it is retail calendar's starting date. The Saturday July 31st is the last Saturday and end of the last retail year.
      • If August 1st is Monday, then Saturday July 30th is end of the last retail year, and July 31st is the start of the current retail year.
  6. ISO calendar: provided in Python datetime module.
    • Example: January 02, 2006 to December 31, 2006.
    • The first week of an ISO year is the first (Gregorian/regular) calendar week of a year containing a Thursday.
    • Different from retail calendar, each week starts at Monday and ends at Sunday.
    • Similar to retail calendar, each ISO year has 52 weeks (occasionally 53 weeks in leap year). Their quarters and months are similarly defined (e.g., 5-4-4).

Out of the above calendar types, retail calendar seems to have more complex rules. However, this calendar type is frequently used in industries like retail and manufacturing for ease of planning around it.

calendars's People

Contributors

tdongsi avatar

Stargazers

Bogdan Sarbu avatar Madhivarman avatar  avatar Blake Burch avatar David Salazar avatar Zeyad Deeb avatar yāλu avatar

Watchers

James Cloos avatar  avatar Christian Altmoos avatar

calendars's Issues

Feature Request - Half Year information

Hi,

This library is very helpful to derive the different type of calendars(fiscal/retail). I have gone through the properties, and the properties added right now is helpful to create a retail/accounting dashboards. But, if we add "Half year" information to all the calendars(Regular/Fiscal/Retail), it will be more helpful for the retailers/demand planners/accounting team to compare year wise Half year sales and arrive at the best decision. This is a feature request, I might be wrong. Let me know your thought on this. I can contribute to add "half-year" property to this library.

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.