Dateless Time objects - a stdlib proposal

Hello,

I wanted to ask what are the general feelings about “dateless” Time
values in Ruby.

A few times I’ve had to struggle with the default Time class, and have
felt that Ruby lacked a data structure to represent simple time values
that are not bound to a specific date.

Think of expressions like “everyday at 18:00”, or “the restaurant always
opens at 11:00 and closes at 23:00”. In these situations there is no
need to think about distance from epoch, timezones, or accommodate for
the DST offset.

In fact, Python’s “datetime.time” class covers this exact use case:
https://docs.python.org/3.5/library/datetime.html#time-objects

I’ve written a tiny gem for this purpose, with a very simple
implementation:
https://rubygems.org/gems/dateless_time

I was wondering if other people would find this useful, and if it could
be a candidate for the Standard Library.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs