Provide time.toInstant method#413
Conversation
d93cb68 to
d02bb08
Compare
@florian-h05 - what is your opinion here? I think the conversions from Java and openHAB types (like native Date, Java |
|
The conversion from from Java and openHAB types clearly is a must-have, and I would also opt to add the |
Okay, let's leave that then. So you'd be okay with removing |
Yes, those conversions always seemed weird, but keep in mind that this is still a breaking change. |
I would only remove them from the new |
|
Okay in that case, no problem 👍 |
Resolves openhab#412 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
d02bb08 to
9a4476d
Compare
florian-h05
left a comment
There was a problem hiding this comment.
Apart from two documentation comments, looks good to me!
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
28b8784 to
024b6ed
Compare
florian-h05
left a comment
There was a problem hiding this comment.
LGTM, thanks!
One minor typo left. Please refrain from further force pushes.
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This provides a convenience method for constructing a
time.toInstantfrom various input types, similar totime.toZDT.The main purpose and motivation is to simplify this:
to the more straight-forward (and faster):
Please note I have deliberately left out a few conversions provided by
time.toZDTwhich I consider slightly misleading and/or bloated, for example considering a number to be a number of milliseconds to be added tonow. This can be achieved by directly using the js-joda classes, e.g.time.Instant.now().plusMillis(500)which to me seems more readable thantime.toInstant(500).I was in doubt whether to even add
time.toInstant()(without parameter) in favor of usingtime.Instant.now(), but it seems so commonly used fortime.toZDTthat I decided to leave it in for first review iteration to be discussed. I also provided those operations working directly on items, although I also have doubts aboutDecimalTypeandQuantityType.Testing
Output:
Resolves #412