gohome
v1.2.0
Published
Easily get info about your work time and when you can go home
Downloads
11
Maintainers
Readme
gohome
This project can calculate your actual work time and show you when you can go home. Your first run will save your start working time and the next run will load time from the saved previous time.
demo
Installation:
npm i gohome -g
Example running:
gohome 8:00
gohome 08:00
gohome 12:11
You can use this package for your next solution like this:
const { gohome } = require('gohome')
const output = gohome(
'8:00', // timeStartWork,
8, // timeWorkMaxHours,
6, // timeWorkMinHours,
30, // timeLaunchMinutes
)
If you want define your current hours and minutes it is possible like this:
const { gohome } = require('gohome')
const output = gohome(
'8:00', // timeStartWork,
8, // timeWorkMaxHours,
6, // timeWorkMinHours,
30, // timeLaunchMinutes,
10, // actual hours,
0, // actual minutes,
)
If you want check your start working time before running gohome function you can use this:
const { gohome, isValidInput } = require('gohome')
const timeStartWork = '8:00'
const isValid = isValidInput(timeStartWork)
if (isValid) {
gohome(
timeStartWork, // timeStartWork,
8, // timeWorkMaxHours,
6, // timeWorkMinHours,
30, // timeLaunchMinutes
)
} else {
console.error(`This start working time is not valid: ${timeStartWork}`)
}