This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Human-readable and reasonable date-time interval formatter | |
* ---------------------------------------------------------- | |
* Author: Benyamin shoham | |
* ----------------------- | |
* Format an interval to show existing components in a Human Readable fashion | |
* If the interval doesn't have a time component (years, months, etc) | |
* That component won't be displayed. | |
* You can decide how many components will be displayed (e.g. "1 year 2 months" = 2 components) | |
* You can select a delimiter to format the interval (e.g. "1 year aaaand 2 months" |