|
1 | 1 | # TimeXt-JavaScript - master branch
|
2 | 2 |
|
3 |
| -[](https://opensource.org/licenses/MIT) |
4 |
| -<a target="_blank" href="https://www.paypal.me/GuepardoApps" title="Donate using PayPal"><img src="https://img.shields.io/badge/paypal-donate-blue.svg" /></a> |
5 |
| - |
6 |
| -[](https://github.com/TimeXt/TimeXt-JavaScript/blob/master/releases/timext-2018-10-28-1.min.js) |
7 |
| -[](https://github.com/TimeXt/TimeXt-JavaScript/tree/master/releases/) |
| 3 | +[](https://www.npmjs.com/package/timext-js) |
| 4 | +[](https://github.com/TimeXt/TimeXt-JavaScript/blob/master/releases/timext-2018-10-28-2.min.js) |
| 5 | +[](https://github.com/TimeXt/TimeXt-JavaScript/releases) |
8 | 6 | [](https://github.com/TimeXt/TimeXt-JavaScript/tree/master/coverage/)
|
9 | 7 |
|
10 |
| -[](https://www.npmjs.com/package/timext-js) |
| 8 | +[](https://opensource.org/licenses/MIT) |
| 9 | +<a target="_blank" href="https://www.paypal.me/GuepardoApps" title="Donate using PayPal"><img src="https://img.shields.io/badge/paypal-donate-blue.svg" /></a> |
11 | 10 |
|
12 | 11 | First of all many thanks to [Kizitonwose](https://github.com/kizitonwose/Time) for the original idea and already awesome library!
|
13 | 12 |
|
14 |
| -This minimized ( < 2kB) library shall help to reduce code like |
| 13 | +This minimized ( < 3kB) library shall help to reduce code like |
15 | 14 |
|
16 | 15 | ```javascript
|
17 | 16 | const dayInMillis = 24 * 60 * 60 * 1000; // Represent a day in milliSeconds
|
@@ -60,9 +59,13 @@ const sixMinutes = Number(6).toMinutes(); // returns timext(6,
|
60 | 59 | const fiftySeconds = Number(50).toSeconds(); // returns timext(50, u.S)
|
61 | 60 | const hundredMilliseconds = Number(100).toMilliseconds(); // returns timext(100, u.MS)
|
62 | 61 |
|
| 62 | +// Return in other time units |
| 63 | +const oneDayInMillis = Number(1).toDays().inMilliseconds();// Returns one day in milliseconds === 24 * 60 * 60 * 1e3 |
| 64 | +const twoWeeksInHours = Number(2).toWeeks().inHours(); // Returns two weeks in hours === 2 * 7 * 24 |
| 65 | + |
63 | 66 | // Convert to other time units
|
64 |
| -const oneDayInMillis = Number(1).toDays().inMilliseconds();// Converts one day into milliseconds === 24 * 60 * 60 * 1e3 |
65 |
| -const twoWeeksInHours = Number(2).toWeeks().inHours(); // Converts two weeks into hours === 2 * 7 * 24 |
| 67 | +const oneDayInMillis = Number(1).toDays().toHours(); // Converts one day into timext(24, u.H) |
| 68 | +const twoWeeksInHours = Number(120).toMinutes().toHours(); // Converts 120 hours into timext(2, u.H) |
66 | 69 |
|
67 | 70 | // add timext to date using date extensions
|
68 | 71 | const inFiveDays = Date.now.plus(Number(5).toDays());
|
|
0 commit comments