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

civil: add AddMonths, AddYears and Weekday methods to Date, DateTime #11339

Open
Vinayaka-B opened this issue Dec 21, 2024 · 1 comment
Open
Labels
triage me I really want to be triaged.

Comments

@Vinayaka-B
Copy link

Is your feature request related to a problem? Please describe.

While using Date and DateTime objects, there might be need for certain operations like -

  1. Getting the date n months in future from given date
  2. Getting the day of the week for a certain date

Describe the solution you'd like

Implementing the methods for the structs

Describe alternatives you've considered

User needs to convert object in time.Time struct do the above operation and convert back to the Date struct. That is inconvenient.

Additional context

Will create a PR for this soon

@Vinayaka-B Vinayaka-B added the triage me I really want to be triaged. label Dec 21, 2024
@Vinayaka-B
Copy link
Author

Vinayaka-B commented Dec 21, 2024

Avoided adding the methods for DateTime struct due to this comment in the code -

// Note: We deliberately do not embed Date into DateTime, to avoid promoting AddDays and Sub.

Don't fully understand why we need to avoid these methods (AddDays, AddMonths, Weekday) for the struct so I can update my PR if some maintainer can confirm that it is okay to add them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant