moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.33k stars 730 forks source link

Add Options in startOf/endOf Method for Millennium, Century and Decade #1532

Open baskalocl opened 11 months ago

baskalocl commented 11 months ago

Is your feature request related to a problem? Please describe. I'd like to enhance the startOf/endOf function in Luxon by adding two new options: millennium, century and decade. Currently, the startOf/endOf function allows for precise date and time manipulation, but it lacks options for larger date units, which can be frustrating when working with historical data and need to set the date to the beginning of a specific millennium or century.

Describe the solution you'd like I propose adding two new options to the startOf method in Luxon:

Based on the previous explanation, rules for endOf method are trivial.

These options would provide users with a convenient way to manipulate date and time data on a larger scale.

Describe alternatives you've considered An alternative solution would be to manually calculate the start of the desired millennium, century or decade and set the date and time accordingly. However, this can be cumbersome and error-prone, especially when dealing with different time zones and calendar systems.

Additional context

Adding these options would make Luxon even more versatile for handling historical and large-scale date and time data. It can be particularly useful in scenarios where precise historical accuracy is required or when working with data that spans over multiple centuries.