brick / date-time

Date and time library for PHP
MIT License
323 stars 29 forks source link

Week class ? #39

Closed palansher closed 2 years ago

palansher commented 2 years ago

Hello!

For my project, I made the "week class". It is useful when working on projects with active weeks periods in accounting. The idea - is not to use time range for week (first day-last day), but use object and store the week in db in one field, as integer week number (1,2 .. 654887). It is very likely as a year has a number (2021 for instance). A week object inself stores first-last dates, some suitable methods and can be easy calculable: i.e. get a week minus three weeks from the certain week (without manipulation with date/dime objects) ... I was surprised that nobody find it convenient before me :)

BenMorel commented 2 years ago

Hi, did you check YearWeek?

palansher commented 2 years ago

Thank you for the tip! Looks useful! Seems it uses ISO-8601 for weeks.

Also, I found your Period It is doesn't support methods a-la "getFirst(Last)DateofPeriod" but also adaptable for my needs.

Also, I saw your money library - looks thoughtful and well designed. Thanks for your valuable contributions to Community!

PS: You can close the issue if you want to clean the feed.

BenMorel commented 2 years ago

Thank you! Closing this one.

It is doesn't support methods a-la "getFirst(Last)DateofPeriod" but also adaptable for my needs.

Please feel free to open an issue if you want to request this feature (with explanation & examples).