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

Boundaries #11

Merged
merged 24 commits into from
Jan 9, 2019
Merged

Boundaries #11

merged 24 commits into from
Jan 9, 2019

Conversation

brendt
Copy link
Collaborator

@brendt brendt commented Dec 19, 2018

Adding boundary support, based on what we discussed in #9.

You'll notice that the default behaviour is "both boundaries included". This might not be everyone's preferred default. I heard the arguments pro and con in #9, but am still convinced that all inclusive is the right default behaviour as long as you're comparing periods with the same accuracy.

We could always add sub classes of Period if desired, with other defaults.

I'll leave this PR open for a while, to see what people think.

For those interested, I wrote down why I think working with precision instead of excluding boundaries is the superior approach: https://stitcher.io/blog/comparing-dates

@brendt
Copy link
Collaborator Author

brendt commented Dec 20, 2018

I believe the discrete unit approach is the correct one for this package. Only allowing same-precision periods to be compared, the open/closed boundary problem becomes obsolete.

We'll keep the boundary functionality, but I've also added precision support.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@MrWeb
Copy link

MrWeb commented Dec 22, 2018

If I say "hey! We have a discount from 1st Dec to 31st" I would think day 1 and 31 are included. I don't get the point of excluding them.

@freekmurze
Copy link
Member

freekmurze commented Dec 23, 2018 via email

@MrWeb
Copy link

MrWeb commented Dec 23, 2018

If you’d say: “hey! We are open from 9:00 to 18:00” Would you close shop at 18:00 or 18:01?

Right, in both mine and your case 31st and 18 are anyways inside the boundaries, aren't they?

@brendt
Copy link
Collaborator Author

brendt commented Jan 9, 2019

Since no one raised any objections to this implementation, I'm going to merge the PR.

@brendt brendt merged commit 8f4bd7b into master Jan 9, 2019
@brendt brendt deleted the boundaries branch January 9, 2019 09:03
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

Successfully merging this pull request may close these issues.

4 participants