gohome
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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

coverage report npm npm npm


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}`)
}

Expected incorrect result will be show in your console like this:

alt 1

Expected correct result if you defined correct start working time:

alt 2

Expected correct result if you worked 6 hours:

alt 3

Expected correct result if you worked more than 8 hours:

alt 4

Package Sidebar

Install

npm i gohome

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

10.7 kB

Total Files

6

Last publish

Collaborators

  • lukas-frantal