question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide time only representation, e.g. LocalTime

See original GitHub issue

Hey,

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:closed
  • Created 3 years ago
  • Reactions:27
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bishibooshcommented, Feb 28, 2022

I made a PR, @kluever @dkhalanskyjb could you maybe review it ?

1reaction
dkhalanskyjbcommented, Mar 18, 2021

introduction of time zones that need to be defined by restaurant owner of inferred from restaurant address/position

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.

filtering of possible duplicities when time is shifted back as those do not make sense for the customer

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found