amaidah / luxon-business-days Goto Github PK
View Code? Open in Web Editor NEWA Luxon plugin for calculating and manipulating business days and holidays.
License: MIT License
A Luxon plugin for calculating and manipulating business days and holidays.
License: MIT License
Hello!
Is there any plan to update luxon-business-days to support newly released Luxon 2.0?
Thanks!
Do you plan to add support to this library to allow it to be imported as ESM (ECMAScript module)?
I'm working on removing CommonJS dependencies from a project. Luxon itself works as ESM, but this plugin doesn't.
Adding custom holidayMatchers didn't work for me I used the example of isCelebratingKobe function changed the dates, plusBusiness is not taking into consideration the dates in isCelebratingKobe at all.
Can one help me in this regards please?
Given this example:
If you iterate the date in line 5 and start incrementing the day value you will notice that sometimes the result date is 9 and sometimes 11 days from the start date. This IMHO should always give the same time difference (I think 11 days is the correct value). There are no holidays in September. Why this is happening?
I guess it is just Friday and my thinking was slow :D Everything works fine... It is a matter of either stepping into one or two weekends...
Thanks for this very useful library. I expected that calling plusBusiness
would retain the time zone but it appears that isn't happening.
Here's an example sandbox that shows if you call plusBusiness
on a DateTime in UTC, the resulting DateTime will be in the local time zone instead of UTC.
I don't see anything in the docs or tests concerning time zones, but it seems likely this is not intended behavior.
Thanks
This is because many of the holiday matchers do an object comparison of the two datetimes. For example, the isThanksgivingDay
returns +inst === +thanksgivingDay
when it should return something like the Christmas matcher matchesMonth && matchesDay
.
const { DateTime } = require('luxon-business-days');
const dt = DateTime.local();
const { availableHolidayMatchers } = dt;
availableHolidayMatchers.isThanksgivingDay(
DateTime.fromObject({ day: 25, month: 11, year: 2021 })
)
// true
availableHolidayMatchers.isThanksgivingDay(
DateTime.fromObject({ day: 25, month: 11, year: 2021, zone: 'UTC' })
)
// false
availableHolidayMatchers.isThanksgivingDay(
DateTime.fromObject({ day: 25, month: 11, year: 2021, hour: 1 })
)
// false
How would you import the getEasterMonthAndDay function from ./helpers when the package is installed from yarn or npm?
Looking through node_modules it seems that the src directory is not there so it cannot be imported directly.
The reason for using this is that sometimes one may need to know the date of Easter and then add a holiday based on this date. e.g. Good Friday which is a holiday in some countries.
Hi,
I'm facing a strange issue: after installing the library with npm, it seems like it's not loaded properly:
do you know why this is happening?
My setup:
v14.17.3
[email protected]
[email protected]
: working fine.[email protected]
Thank you
In my code, I give user a function to select optional holidays. It's a lot more clean & less prone to error when I can pass these to the methods like plusBusiness
, compared to trying to set/unset the matcher each time.
Please implement the @types/luxon-business-days in order to work with typescript, like the main library ๐
Hi, it doesn't look like you support different working weeks (based on region) out of the box? This seems pretty fundamental for a business days plugin?
https://en.wikipedia.org/wiki/Workweek_and_weekend
Please correct me if I'm wrong as I'd love to use your plugin?
Thanks
There are many ways to create DateTimes-> https://moment.github.io/luxon/api-docs/index.html the library should work with all of them. This should be tested so we don't have another situation like this: #61
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.