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

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

Open
baskalocl opened this issue Oct 30, 2023 · 0 comments
Open

Comments

@baskalocl
Copy link

baskalocl commented Oct 30, 2023

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:

  • millennium: This option should set the date to the start of the current millennium (e.g., for January 1, 1989, it will set the date to January 1, 1000).
  • century: This option should set the date to the start of the current century (e.g., for January 1, 1989, it will set the date to January 1, 1900).
  • decade: This option should set the date to the start of the current decade (e.g., for January 1, 1989, it will set the date to January 1, 1980).

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.

@baskalocl baskalocl changed the title Add Options in startOf Method for Millennium, Century and Decade Add Options in startOf/endOf Method for Millennium, Century and Decade Oct 30, 2023
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

1 participant