Closed maniac103 closed 1 year ago
IMO toStartOfDay
is more concise, because toMidnight
doesn’t make clear which midnight is meant: the one this morning or the one this evening?
toStartOfDay
is clear: the start of this day and more in line with toToday
.
Anyway, I am wondering why you need such a method: For your use case I would simplify do:
time.toZDT(„00:00“);
Sorry for the wrong hyphens, my smartphones keyboard :-/
Anyway, I am wondering why you need such a method: For your use case I would simplify do:
Looking at the code, that indeed works as well ... and even is documented as such ;-) Issue is just that you need to know this is actually possible, as otherwise you won't even read the respective docs. Maybe it's just me, but when dealing with unknown API I tend to check for methods that look related and then reading the docs for those methods. It didn't occur to me to check toZDT()
in that case. I therefore think a toStartOfDay
convenience method makes sense; leaving it up to you to decide on :+1: / :-1: though. If you think it's OK, I can implement it.
I understand your idea, but I‘d like to keep the API clean and only add methods that add additional functionality or make something much easier to use, which is not the case here.
So, sorry 👎
We should maybe extend the examples in the README to actually show what’s possible with time.toZDT
.
Fair enough. Yes, extending the examples sounds like a good idea.
Do you want to extend the examples yourself?
In a lot of rules, I have a need for creating a timestamp at midnight (e.g. for determining today's energy usage). Currently, I have to use a somewhat cumbersome syntax:
It would be great if there was a shorter/more concise version for this, like
Additionally, there could be a
withTime()
method: