Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/manveru/relativity

Relative time in a day, in a week, etc.
https://github.com/manveru/relativity

Last synced: 19 days ago
JSON representation

Relative time in a day, in a week, etc.

Awesome Lists containing this project

README

        

= Relativity

Time, Date and DateTime classes don't have a mode for working with relative
time inside 1 day (or 1 week, 1 month, 1 quarter, etc.).

A relative time object, relative to a day or a week, is useful to describe
e.g. opening hours of a business. In a next phase, time ranges will
be built on top, so the ranges of opening hours can be represented.

== Example

require 'relativity'
opens_at = DayTime.new(9) #=> 09:00:00
closes_at = DayTime.new(18,30) #=> 18:30:00

dt = DayTime.new #=> 21:17:40
dt.seconds_since_start #=> #
dt.hours #=> 21
dt.minutes #=> 17
dt.seconds #=> 40
dt.nano_seconds #=> 568257238