docs: Instant vs ZonedDateTime #286
Replies: 2 comments
|
Hi @iloveitaly, thanks for posting: I'm always happy to hear feedback about the API 🙌 First, the short answer: ZonedDateTime.now(<chosen timezone>).start_of_day()Or, if you'd like to get the start of the day in the currently set system timezone SystemDateTime.now().start_of_day()If you're only interested in the current date on the system, you can also do Now, on to the deeper discussion
There's definitely room for improvements to the docs here, but the absence of many of You are certainly not alone in your struggles. Question for you: what would have been most helpful for you to clear this up?
Also, feel free to share a bit more of your use case this also helps me improve the API. |
|
The latest release includes a new FAQ item about this. See here |
Uh oh!
There was an error while loading. Please reload this page.
Love the library!
I feel like I'm missing something obvious:
This is the best way I've found to get the start of the current day. It looks like you can't do this via the
Instantobject and converting to aZonedDateTimeis the only way to getstart_of_dayhelpers and friends.However, there's no
now()method onZonedDateTime, which makes getting the current time cumbersome. It's also confusing to me whyInstantdoesn't have theZonedDateTimehelpers.I'm happy to contribute changes to the docs to explain this. If someone could explain to me how it works first! Thanks.
All reactions