Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WorkingDays plugin #868

Open
fes300 opened this issue Apr 15, 2020 · 12 comments
Open

WorkingDays plugin #868

fes300 opened this issue Apr 15, 2020 · 12 comments

Comments

@fes300
Copy link

fes300 commented Apr 15, 2020

Issue type

proposal

Description

recently I had the need for a function that calculate working days (days - weekends - custom array of holidays) from a certain date. I believe it could be easily translated into a plugin if anyone is sharing the same need.

@iamkun
Copy link
Owner

iamkun commented Apr 16, 2020

It will be great if you could build your own plugin and publish it to npm so that could share it with others easily.

@fes300
Copy link
Author

fes300 commented Apr 16, 2020

thanks @iamkun, will surely do :)

@ConorWatsonSoar
Copy link

ConorWatsonSoar commented Apr 16, 2020

Hey @fes300 @iamkun, in a weird turn of events I was looking for the exact same thing yesterday. I forked dayjs yesterday and spent the day writing a BusinessDays plugin. I was intending to put the PR in later on today.

@iamkun, would you rather the plugin was published separately from DayJS? It's just that in your docs you say "Feel free to open a pull request to share your plugin."

The plugin I wrote only supports Business Days (i.e no Holidays) at the moment, as I wanted to discuss that with you @iamkun. Holidays would probably require using Locale, but I see that Locale is also a plugin for Dayjs. Should a plugin require another plugin?

@iamkun
Copy link
Owner

iamkun commented Apr 16, 2020

Hi, Of course, all plugins are welcomed.

However, we only choose those PRs which suit most of our users' needs to get merged into our main code.

For plugins that targeting to some specific use case, it's better to manage by their own, such as https://github.com/alibaba-aero/jalaliday

@ConorWatsonSoar
Copy link

Hey guys, we've just published our Business Days plugin to npm. You can also find the source code on our Github.

We are more than happy to accept bugs, improvements and PRs!

@Nicoowr
Copy link

Nicoowr commented Dec 16, 2020

@ConorWatsonSoar Hi, I'd like to contribute to your businessDays plugin, but it seems the repo is not maintained anymore?(issues are not treated) If so I'd be happy either to get involved in its development on your repo or to fork it and keep developing it on my side since I really need such a feature.

Looking forward to hearing from you

@Nicoowr
Copy link

Nicoowr commented Dec 16, 2020

@iamkun how are users' needs determined? Some other repos use "👍" count on each proposal, is it the case here? I feel that a business days plugin would be useful for many people since moment-business-days is downloaded 58k times / week

@iamkun
Copy link
Owner

iamkun commented Dec 16, 2020

yes, it's worth taking a look at https://www.npmjs.com/package/moment-business-days to see if we should support it as an official plugin.

@MrFarhan
Copy link

I also have the same requirement of working days plugin

@karlhorky
Copy link

Additional Prior Art

In case this helps an official business days plugin happen, date-fns also has a few functions for business days:

@karlhorky
Copy link

@ConorWatsonSoar Hi, I'd like to contribute to your businessDays plugin, but it seems the repo is not maintained anymore?(issues are not treated) If so I'd be happy either to get involved in its development on your repo or to fork it and keep developing it on my side since I really need such a feature.

It seems like @reediculous456 has an updated, maintained version over here:

@karlhorky
Copy link

@iamkun now that a few years have passed, what's your current take on getting an official first-party plugin for business days / working days in Day.js?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants