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

feat: added Date::today() method. #664

Closed
wants to merge 1 commit into from
Closed

feat: added Date::today() method. #664

wants to merge 1 commit into from

Conversation

avhz
Copy link

@avhz avhz commented Feb 16, 2024

Hi, thanks for the great library.

Just wondering if there could be a method added to get a Date with today's date.

OffsetDateTime has .now_utc() for example, which means I can do something like:

let today: Date = OffsetDateTime::now_utc().date();

But I thought it might be convenient for Date to have its own now method. e.g.

let today: Date = Date::today();

Happy to adjust the PR if needed of course.

@jhpratt
Copy link
Member

jhpratt commented Feb 16, 2024

This is a deliberate omission that was present in v0.2 but removed in v0.3. Assuming a time zone is not an acceptable tradeoff.

@jhpratt jhpratt closed this Feb 16, 2024
@jhpratt jhpratt added the C-feature-request Category: a new feature (not already implemented) label Feb 16, 2024
@avhz
Copy link
Author

avhz commented Feb 16, 2024

No worries.

Could you clarify what you mean? I must be missing something.
Where does the time zone data come into play if it returns a Date?

@jhpratt
Copy link
Member

jhpratt commented Feb 16, 2024

It isn't the same day everywhere on earth.

@avhz
Copy link
Author

avhz commented Feb 16, 2024

Ah I see what you mean. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: a new feature (not already implemented)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants