forked from moment/moment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaning up the rounding on _date.from()
Adding documentation for what text would be shown when. Fixing '1 minutes ago' bug. Use Math.round instead of Math.floor for the nearest date.
- Loading branch information
Showing
7 changed files
with
183 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ <h1 class="logo"> | |
<p>Underscore.date is a javascript date library that helps create, manipulate, and format dates without extending the Date prototype.</p> | ||
|
||
<p>Author: Tim Wood ([email protected])</p> | ||
<p>Version: 0.5.1</p> | ||
<p>Version: 0.5.2</p> | ||
<p class="filesize">1.82 kb (min + gzip)</p> | ||
|
||
<h2>Download</h2> | ||
|
@@ -416,7 +416,73 @@ <h2>_date.format()</h2> | |
_date([2007, 0, 27]).from(_date([2007, 0, 28]), true , true) // 86400000);</code></pre> | ||
|
||
<p>The base strings for this function can be customized with <code>_date.relativeTime</code>.</p> | ||
|
||
<p>The breakdown of which string is displayed when is outlined in the table below.</p> | ||
|
||
<table> | ||
<tr> | ||
<th>Range</th> | ||
<th>Key</th> | ||
<th>Sample Output</th> | ||
</tr> | ||
<tr> | ||
<td>0 to 45 seconds</td> | ||
<td>s</td> | ||
<td>seconds ago</td> | ||
</tr> | ||
<tr> | ||
<td>45 to 90 seconds</td> | ||
<td>m</td> | ||
<td>a minute ago</td> | ||
</tr> | ||
<tr> | ||
<td>90 seconds to 45 minutes</td> | ||
<td>mm</td> | ||
<td>2 minutes ago ... 45 minutes ago</td> | ||
</tr> | ||
<tr> | ||
<td>45 to 90 minutes</td> | ||
<td>h</td> | ||
<td>an hour ago</td> | ||
</tr> | ||
<tr> | ||
<td>90 minutes to 22 hours </td> | ||
<td>hh</td> | ||
<td>2 hours ago ... 22 hours ago</td> | ||
</tr> | ||
<tr> | ||
<td>22 to 36 hours</td> | ||
<td>d</td> | ||
<td>a day ago</td> | ||
</tr> | ||
<tr> | ||
<td>36 hours to 25 days</td> | ||
<td>dd</td> | ||
<td>2 days ago ... 25 days ago</td> | ||
</tr> | ||
<tr> | ||
<td>25 to 45 days</td> | ||
<td>M</td> | ||
<td>a month ago</td> | ||
</tr> | ||
<tr> | ||
<td>45 to 345 days</td> | ||
<td>MM</td> | ||
<td>2 months ago ... 11 months ago</td> | ||
</tr> | ||
<tr> | ||
<td>345 to 547 days (1.5 years)</td> | ||
<td>y</td> | ||
<td>a year ago</td> | ||
</tr> | ||
<tr> | ||
<td>548 days+</td> | ||
<td>yy</td> | ||
<td>2 years ago ... 20 years ago</td> | ||
</tr> | ||
</table> | ||
|
||
|
||
<h2>_date.fromNow()</h2> | ||
|
||
<pre><code>_date.fromNow(withoutSuffix:boolean, asMilliseconds:boolean)</code></pre> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "underscore.date", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Underscore.date is a javascript date library that helps create, manipulate, and format dates without extending the `Date` prototype.", | ||
"homepage": "https://github.com/timrwood/underscore.date", | ||
"author": "Tim Wood <[email protected]> (http://timwoodcreates.com/)", | ||
|
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
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
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
Oops, something went wrong.