-
Notifications
You must be signed in to change notification settings - Fork 152
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
Rename MonthDay.toDate() and YearMonth.toDate() #722
Comments
This is in order to reduce confusion when using the method with a number literal. See: #722
This is in order to reduce confusion when using the method with a number literal. See: #722
This is in order to reduce confusion when using the method with a number literal. See: #722
This is in order to reduce confusion when using the method with a number literal. See: #722
Hi. New to this project.
Then for YearMonth we can use:
and for MonthDay:
(Actually Java uses I guess this has already been discussed a lot:-) but before this issue came up. |
Or, as we have a withTime but for issue #729, there would be |
Then welcome, and thanks for your feedback here and on the other tickets you've opened! Until recently, those methods were in fact named withTime, etc. The full background of the discussion is in #574, but the summary is that the experience in an IDE is much better when you can type That said, the naming is of course still open to discussion, so I will reopen that issue with the "feedback" tag so that we will re-examine it before freezing the API. What would be for you the motivation for changing back to withTime/withDate/etc.? |
Welcome @thojanssens! One addition to @ptomato's note above: in addition to IDE support, another reason for the
|
It deserves another thought as the talks happened before the possible addition of: If using the I understand though the For example, I can naturally understand that a Date combined with a Time gives a DateTime. BUT an Absolute and a Time zone? What does that give? Well naturally I would say it gives exactly that, an Absolute combined with a Time zone. Not a DateTime without time zone. Same question, what is a DateTime with a Time zone? It is a "zoned date time", right? But I have to look at the docs to understand that I actually get an Absolute, and again losing the time zone information. Therefore, to me,
I'd like you to consider having |
@thojanssens Since this issue will auto-close when I merge #723, I've opened #747 to continue the discussion, you may want to subscribe there. |
This is in order to reduce confusion when using the method with a number literal. See: #722
This is in order to reduce confusion when using the method with a number literal. See: #722
I find these two particular toDate() methods to read confusingly when used with a number literal:
I think these two are special cases, different than the other conversion methods, because they are the only ones that can be used with number literals.
I would propose renaming MonthDay.toDate() to MonthDay.toDateIn(), which reads like a sentence ("date in 2020"). I don't have a good suggestion for YearMonth.toDate(), but the best I can think of is YearMonth.toDateOn(), analogous to toDateIn(). Unlike toDateIn() it doesn't read like a sentence, but it at least gives a clue:
The text was updated successfully, but these errors were encountered: