Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Feb 22, 2020
1 parent d2b6279 commit db43aa7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
12 changes: 8 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@
"label": "install",
"type": "shell",
"command": "yarn",
"group": "none"
"group": "none",
"problemMatcher": []
},
{
"label": "autoclean",
"type": "shell",
"command": "yarn autoclean --force",
"group": "none"
"group": "none",
"problemMatcher": []
},
{
"label": "publish",
"label": "publish (registry settings covered)",
"type": "shell",
"command": [
"npm publish --access=public"
"npm config set registry https://registry.npmjs.org/",
"npm publish --access=public",
"npm config set registry https://registry.npm.taobao.org"
],
"problemMatcher": []
}
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

It's a lib which let you to transfer human time to computer-readable time and also to transfer computer-generated time to human time, available for English and Chinese.

## How to use

```javascript
var shi = require('node-shi');

// human time -> time in Arabic number as seconds
shi.humanTimeParser("five hundreds and twenty one seconds")//521
shi.humanTimeParser("a day and 一 hour, 52 min 16sec")//93136
shi.humanTimeParser("三十三分钟", { to: "m" })//33
shi.setDefault({ as: 'm' }//set default
shi.humanTimeParser("50", { to: 'h' }))//0.8333333333333334
shi.humanTimeParser("50", { as: 'h', to: 'm' }))//3000
shi.clearDefault(//clear defaults

// unit convert
shi.unitConverter(60, 'm', 'h')//1
shi.unitConverter(1, "d", "ms")//86400000

// time in Arabic number -> human time
shi.ArabicNumberTimeParser(1500)//25 minutes
shi.ArabicNumberTimeParser(36, { lang: 'fr', to: 'h' })//0,01 heure
shi.ArabicNumberTimeParser(1, { lang: 'zh_CN', as: 'h', to: 'ms' })//3600000 毫秒
```
## Features
### Human time -> time in Arabic number
Expand All @@ -19,7 +43,7 @@ It's a lib which let you to transfer human time to computer-readable time and al
### Time unix translate
- Arabic number in different unixs *(h/min/s/ms)* -> time in Arabic number as *(h/min/s/ms)*
- Arabic number in different unixs `d, h, m, s, ms` -> time in Arabic number as `d, h, m, s, ms`
## Future of this project
Expand Down

0 comments on commit db43aa7

Please sign in to comment.