Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/manveru/relativity
- Owner: manveru
- License: mit
- Created: 2012-01-13T08:45:32.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-01-12T15:09:45.000Z (almost 13 years ago)
- Last Synced: 2024-11-05T18:50:51.549Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- Changelog: Changelog.rdoc
- License: MIT-LICENSE
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:00dt = DayTime.new #=> 21:17:40
dt.seconds_since_start #=> #
dt.hours #=> 21
dt.minutes #=> 17
dt.seconds #=> 40
dt.nano_seconds #=> 568257238