Miss any of our Open RFC calls?Watch the recordings here! »

@clebertsfigueiredo/totime

0.0.4 • Public • Published

ToTime

This is a time conversion package.

INSTALL

npm i @clebertsfigueiredo/totime

IMPORT

const totime = require('@clebertsfigueiredo/totime')
// or
import totime from '@clebertsfigueiredo/totime'

USE

const { minutesToHours } = require('@clebertsfigueiredo/totime')
 
const response = minutesToHours(85)
 
console.log(response) // '01:25'
 

METHODS

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.: <minutes>:<seconds>, does not return the time
 
// Transform time to minutes
timeToMinutes('02:00') // Output: 120
 
// Transform time to seconds
timeToSeconds('02:00') // Output: 7200
 

Install

npm i @clebertsfigueiredo/totime

DownloadsWeekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

30.7 kB

Total Files

33

Last publish

Collaborators

  • avatar