Comparing version 0.1.1 to 0.1.2-majon.0
@@ -19,2 +19,3 @@ 'use strict'; | ||
parse : require('./parse'), | ||
toSeconds : require('./toSeconds'), | ||
}; |
@@ -14,3 +14,3 @@ { | ||
"name": "dafo", | ||
"version": "0.1.1", | ||
"version": "0.1.2-majon.0", | ||
"main": "index.js", | ||
@@ -17,0 +17,0 @@ "keywords": [ |
@@ -21,2 +21,3 @@ # dafo | ||
* [dafo.parse](#dafoparse) | ||
* [dafo.toSeconds](#dafotoseconds) | ||
* [Others](#others) | ||
@@ -198,2 +199,22 @@ * [Why dafo](#why-dafo) | ||
### dafo.toSeconds | ||
```javascript | ||
const dafo = require('dafo'); | ||
let secondCount = dafo.toSeconds('1d2h'); | ||
``` | ||
* Date __dafo.toSeconds__(string *age*) | ||
Argument *age* is an expression used to describe age, generally that of HTTP cache. | ||
| Unit | Meaning | | ||
| :---- | :------------------------------------------ | | ||
| __s__ | second(s) | | ||
| __m__ | minute(s) | | ||
| __h__ | hour(s) | | ||
| __d__ | day(s) | | ||
| __M__ | month(es) | | ||
| __Y__ | year(s) | | ||
### Others | ||
@@ -200,0 +221,0 @@ |
@@ -0,1 +1,5 @@ | ||
/** | ||
* 本例中,部分测试用例依赖的占位符尚未实现。 | ||
*/ | ||
'use strict'; | ||
@@ -164,3 +168,3 @@ | ||
it('Y/m/d/H\\H/is', () => { | ||
console.log(date_format(d1, 'Y/m/d/H\\H/is')); | ||
assert.strictEqual(date_format(d1, 'Y/m/d/H\\H/is'), '2000/01/01/13H/1406'); | ||
}); | ||
@@ -167,0 +171,0 @@ |
@@ -118,2 +118,12 @@ 'use strict'; | ||
it.only('toSeconds()', () => { | ||
assert.equal(dafo.toSeconds( '30s'), 30); | ||
assert.equal(dafo.toSeconds( '1m'), 60); | ||
assert.equal(dafo.toSeconds( '1h'), 3600); | ||
assert.equal(dafo.toSeconds( '1d'), 86400); | ||
assert.equal(dafo.toSeconds( '1d1m'), 86400 + 60); | ||
assert.equal(dafo.toSeconds( ' 1M'), 86400 * 30); | ||
assert.equal(dafo.toSeconds( ' 1y'), 86400 * 365); | ||
assert.equal(dafo.toSeconds( ' 1Q'), 86400 * 90); | ||
}) | ||
}); |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
57503
1229
273
1