Giter VIP home page Giter VIP logo

Comments (2)

ghiculescu avatar ghiculescu commented on June 24, 2024 1

Ignore the above, just read #35 and the attached code and now I better understand. In ANZAC Day's case we are adding additional dates for particular regions, whereas for NYD we want to remove a date from applying for a particular region.

Looking at Adam's original commit, how about this as an API:

  - name: New Year's Day
    regions: [au, au_nsw, au_vic, au_act, au_sa, au_wa, au_nt, au_qld, au_tas]
    mday: 1
    observed: au_nyd_observed_to_monday_if_weekend(date, region)
    function: au_nyd_function_to_monday_if_weekend(date, region)

I should learn more about the holidays internals - I don't really know how feasible this is - but my idea is that we'd pass an optional region argument to all observed/function methods. You can then use this to return nil if you want to. So in this case, au_nyd_observed_to_monday_if_weekend would return nil for :au_tas, and au_nyd_function_to_monday_if_weekend would return nil for anything except :au_tas. They would probably all call to_monday_if_weekend internally for all other cases.

Most importantly (to me) this wouldn't require upstream code changes, unlike the :exact suggestion

Thoughts?

from definitions.

ghiculescu avatar ghiculescu commented on June 24, 2024

You say that any :au holiday will also apply to :au_tas too. How does that work with ANZAC Day? According to my link there's an :au wide definition, then more specific ones for the states that handle how it is observed.

(I haven't been following this closely over the last two weeks so forgive me if this has already been answered.)

from definitions.

Related Issues (20)

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.