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

Breaking DateAndTime #1183

Closed
bodiam opened this issue May 1, 2024 · 4 comments
Closed

Breaking DateAndTime #1183

bodiam opened this issue May 1, 2024 · 4 comments
Assignees
Labels

Comments

@bodiam
Copy link
Contributor

bodiam commented May 1, 2024

Hi all,

Another proposal: I'm thinking of breaking DateAndTime.

At the moment, it's using java.sql.Timestamp for future(), past() and birthday() methods. I don't think anyone would use a SQL Timestamp for these kind of things, and I'm thinking of changing it. I'm not sure how to deprecate them since I want to change the return type, but keep the method names and the provider it's in (I could make a new one and deprecate this one, but I'm not sure how to call it. TimeAndDate? DateAndTime2? I also plan on removing all references to java.util.Date.

The plan is to make birthday() return a LocalDate, and future and past I'm not sure of yet. Perhaps a ZonedDateTime, or an OffsetDateTime?

Suggestions welcome, if no objections, I will implement the above.

@bodiam bodiam added the proposal label May 1, 2024
@kingthorin
Copy link
Collaborator

I agree that getting rid of java.sql.Timestamp usage is likely a good move. Is there a reason to move away from java.util.Date? (Not that I'm against it, I just want to understand the direction a bit better.)

Both ZonedDateTIme and OffSetDateTime support plus and minus methods so that seems like a simple way to handle future and past.

@bodiam
Copy link
Contributor Author

bodiam commented May 1, 2024

I think java.util.Date is not something anyone should use with the introduction of java.time, and that's now more than 10 years ago! Also, Gavin King says you shouldn't: https://in.relation.to/2024/04/22/stop-using-date/

Also:

image

(source: https://stackoverflow.com/questions/32437550/whats-the-difference-between-instant-and-localdatetime/32443004#32443004)

So, possibly, we should be using Instant instead.

@kingthorin
Copy link
Collaborator

Thanks, great resources. Makes sense.

@asolntsev
Copy link
Collaborator

I guess this issue can be closed because it was implemented in #1210 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants