https://github.com/clebsf/totime
https://github.com/clebsf/totime
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/clebsf/totime
- Owner: clebsf
- License: mit
- Created: 2020-01-03T13:17:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-11T17:21:29.000Z (almost 5 years ago)
- Last Synced: 2025-10-11T02:36:03.233Z (8 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ToTime
This is a time conversion package.




### INSTALL
```
npm i @clebertsfigueiredo/totime
```
### IMPORT
```js
const totime = require('@clebertsfigueiredo/totime')
// or
import totime from '@clebertsfigueiredo/totime'
```
### USE
```js
const { minutesToHours } = require('@clebertsfigueiredo/totime')
const response = minutesToHours(85)
console.log(response) // '01:25'
```
### METHODS
```js
const {
intervalInMinutes,
minutesToHours,
secondsToHours,
secondsToMinutes,
timeToMinutes,
timeToSeconds
} = require('@clebertsfigueiredo/totime')
// Gets the interval in minutes
intervalInMinutes('14:10', '14:30') // Output: 20
// Transform minutes into hours
minutesToHours(125) // Output: '02:05'
// Transform seconds into hours
secondsToHours(10860) // Output: '03:01'
secondsToHours(14465) // Output: '04:01:05'
// Transform seconds into minutes
secondsToMinutes(60) // Output: '01' **minutes
secondsToMinutes(75) // Output: 01:15 **PS.: :, does not return the time
// Transform time to minutes
timeToMinutes('02:00') // Output: 120
// Transform time to seconds
timeToSeconds('02:00') // Output: 7200
```