Last active
August 29, 2015 14:05
-
-
Save natchiketa/2d5890dcf87cb68d85d0 to your computer and use it in GitHub Desktop.
Create time range in minute increments w/Lo-Dash and time.js
This file contains hidden or 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
| # Requires Lo-Dash and zever/time.js | |
| timeFromMinutes = (mins) -> | |
| Time ("#{((if mins < 780 then ~~(mins / 60) else (~~(mins / 60) - 12)))}:#{mins % 60} ") | |
| .replace(/:0 /, ":00 #{if mins >= 720 then 'PM' else 'AM'}") | |
| minuteIncrements = (range) -> | |
| _.map range, (mins) -> | |
| timeFromMinutes mins | |
| minuteIncrements _.range(540, 1260, 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment