Provide time only representation, e.g. LocalTime
See original GitHub issueHey,
Currently there is support for LocalDateTime
, but I would like to use some time representation without a date. Ideall would be something like LocalTime
for my use case.
my use case: represent daily events
my current workaround:
use DateTimePeriod
with a max of 24h in total
Issue Analytics
- State:
- Created 3 years ago
- Reactions:27
- Comments:18 (9 by maintainers)
Top Results From Across the Web
LocalTime (Java Platform SE 8 ) - Oracle Help Center
LocalTime is an immutable date-time object that represents a time, often viewed as hour-minute-second. Time is represented to nanosecond precision. For example, ...
Read more >time — Time access and conversions — Python 3.11.1 ...
New in version 3.7. Convert a time expressed in seconds since the epoch to a string of a form: 'Sun Jun 20 23:21:05...
Read more >Create a Date with a set timezone without using a string ...
Once you've constructed one it will represent a certain point in "real" time. The time zone is only relevant when you want to...
Read more >Date and Time Formats - W3C
Times are expressed in local time, together with a time zone offset in hours and minutes. A time zone offset of "+hh:mm" indicates...
Read more >Java 8 Date Time - 20 Examples of LocalDate, LocalTime ...
So anytime if you just to represent date without time, use this class. ... equal method to provide date equality, as shown in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I made a PR, @kluever @dkhalanskyjb could you maybe review it ?
Does not seem all that terrible. For any fixed-offset time zones, the proposed solution works the same as the one you provided, so having a default of
TimeZone.UTC
or something in the same vein would mean that only the owners who don’t mind manually setting their time zones would be affected.I would argue that the duplicities should, in fact, not be filtered. If the time shift occurred outside of working hours, it won’t be reflected in the schedule anyway, but if it occurred during the workday, then some time slots would have an ambiguous meaning. So, a user who made a reservation at 13:00 on a day when 13:00 occurs twice wouldn’t know when the reservation actually begins and so would have to call the restaurant or do something else like that. If, however, duplicate entries were present, the user could conceivably remember (or be reminded by some text in the app) that there is a DST transition; then they would explicitly be making a reservation at the first time it’s 13:00.
The bottom line is that it looks like the domain you’re modelling does require handling time zone transitions, you just simplified this for the sake of ease of use in exchange for robustness. This may be a perfectly valid tradeoff in your case, but, from the library design perspective, the choice to ignore transitions must be done explicitly and with the full understanding of the consequences, so it seems for now that the (problematic in many cases)
LocalTime
arithmetic should not be very easily available.Thanks for the elaboration, this does help a lot!