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

Adding DateTime part functions #3669

Merged
merged 18 commits into from
Aug 26, 2022
Merged

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented Aug 25, 2022

Pull Request Description

  • Added Zone, Date_Time and Time_Of_Day to Standard.Base.
  • Renamed Zone to Time_Zone.
  • Added century.
  • Added is_leap_year.
  • Added length_of_year.
  • Added length_of_month.
  • Added quarter.
  • Added day_of_year.
  • Added Day_Of_Week type and day_of_week function.
  • Updated week_of_year to support ISO.

Important Notes

  • Had to pass locale to formatter for date/time tests to work on my PC.
  • Changed default of week_of_year to use ISO.

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH
      ./run ide build and ./run ide watch.

@jdunkerley jdunkerley force-pushed the wip/jd/date-time-parts-183081112 branch from d380b85 to da23c59 Compare August 26, 2022 08:52
@jdunkerley jdunkerley marked this pull request as ready for review August 26, 2022 08:52
Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the Zone -> Time_Zone rename, I think it's much clearer now.

I don't understand why in many places we roll our own logic instead of relying on available Java utils (which are rather commonly used so I think we can rely on them without adding tons of tests).

Still, I'm not sure Java is prepared for handling dates prior to 1AD very well, which is understandable as most usecases do not care about such dates. Still, I think according to the philosophy of avoiding data corruption at all costs and preferring crashes to data corruption - I think we should consciously throw an exception for operations that we know that would lead to wrong results. So I think we should either add a few tests for BC dates to make sure they work correctly OR throw exceptions saying explicitly that our tool does not support these kinds of dates.

@jdunkerley jdunkerley marked this pull request as draft August 26, 2022 11:30
@jdunkerley jdunkerley requested a review from radeusgd August 26, 2022 12:31
@jdunkerley jdunkerley marked this pull request as ready for review August 26, 2022 12:56
Test for Day_Of_Week.
@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label Aug 26, 2022
@mergify mergify bot merged commit a20d433 into develop Aug 26, 2022
@mergify mergify bot deleted the wip/jd/date-time-parts-183081112 branch August 26, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants