Created
June 20, 2013 12:12
-
-
Save mctep/5822230 to your computer and use it in GitHub Desktop.
Draft time left counter. Return how much time had left from timestamp.
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
| timec.i18n('en-US', function(frame, value) { | |
| var plural = !(value[value.length - 1] == 1); | |
| switch frame { | |
| case this.DAY: { | |
| return plural | |
| ? 'days' | |
| : 'day' | |
| } break; | |
| case this.MONTH: { | |
| return plural | |
| ? 'months' | |
| : 'month' | |
| } | |
| case this.WEEK: { | |
| return plural | |
| ? 'weeks' | |
| : 'week' | |
| } | |
| /* ... */ | |
| } | |
| }); | |
| timec(timestamp, 'Left %months, %weeks and %days') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment