@mangar2/time
v1.1.3
Published
time helper functions
Downloads
6
Readme
Abstract
Contents
Meta
Global functions
dateToTimeOfDayInSeconds
dateToTimeOfDayInSeconds (date) => {number}
Gets the seconds since midnight of a date .
dateToTimeOfDayInSeconds Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| date
| Date
| date to concider | |
dateToTimeOfDayInSeconds returns
| Type | Description |
| ---- | ----------- |
| number
| amount of seconds passed since midnight |
isTimeOfDayString
isTimeOfDayString (timeString) => {boolean}
Checks , if a string is a time of day string ( HH : MM or HH : MM : SS )
isTimeOfDayString Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| timeString
| string
| delta time | |
isTimeOfDayString returns
| Type | Description |
| ---- | ----------- |
| boolean
| true , if the string is a time of day string |
stringToSeconds
stringToSeconds (timeString) => {number}
Converts a time string in format HH : MM or HH : MM : SS or MMM to seconds
stringToSeconds Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| timeString
| string
| delta time | |
stringToSeconds throws
| Type | Description |
| ---- | ----------- |
| Error
| on false date format |
stringToSeconds returns
| Type | Description |
| ---- | ----------- |
| number
| time string in seconds |
timeOfDayStringToDate
timeOfDayStringToDate (timeString) => {Date}
Converts a time string in format HH : MM or HH : MM : SS or MMM to a date ( today , same time of day )
timeOfDayStringToDate Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| timeString
| string
| time of day | |
timeOfDayStringToDate throws
| Type | Description |
| ---- | ----------- |
| Error
| on false time format |
timeOfDayStringToDate returns
| Type | Description |
| ---- | ----------- |
| Date
| today , hours , minutes , seconds set to the time of day string |