Namespace: date

date

Methods

(static) module.exports(minutes, showSeconds) → {String}

Parameters:
Name Type Description
minutes Number
showSeconds Boolean
Source:
See:
  • beautifySeconds Works the same way as beautifySeconds, but receive an amount of minutes
Returns:
Type
String
Example
beautifyMinutes(66) // '1h06m'

(static) module.exports(seconds, showSeconds) → {string}

Receive a number of seconds and return an string representing the amount of hours on the format: 00h00m00s
Parameters:
Name Type Description
seconds Number
showSeconds Boolean
Source:
Returns:
Type
string
Examples
beautifySeconds(60, false) => 01m
beautifyMinutes(120, false) => 02m
beautifyMinutes(3900, false) => 1h05m
beautifyMinutes(3900, true) => 1h05m00s

(static) module.exports() → {String}

Returns the current date on the format: yyyy-mm-dd
Source:
Returns:
Type
String
Example
curdate() // '2016-01-01'

(static) module.exports(startDateString, endDateString) → {Number}

Receive two dates and returns the amount of days between them Dates on the format supported by the Date constructor
Parameters:
Name Type Description
startDateString String
endDateString String
Source:
Returns:
Type
Number
Example
daysBetween('2016-01-01', '2016-01-03') // 2

(static) module.exports(curdateopt) → {String}

Returns the first day of the current month on the format: yyyy-dd-mm
Parameters:
Name Type Attributes Description
curdate Date <optional>
Source:
Returns:
Type
String
Examples
// considering that today is 2016-01-22
firstDayOfTheMonth() // '2016-01-01'
firstDayOfTheMonth(new Date('2021-05-22')) // '2021-05-01'

(static) module.exports(theTime) → {Number}

Receives an duration with the format 00h00m00s and returns the amount of seconds. The inverse of beautifySeconds
Parameters:
Name Type Description
theTime String
Source:
Returns:
Type
Number
Example
fromBeutyToSeconds('1h39m5s') // 5945

(static) module.exports(month, year) → {String}

Returns the last day of the month on the format: yyyy-mm-dd It accepts an optional month and year to get the last day of an particular month
Parameters:
Name Type Description
month String | number
year String | number
Source:
Returns:
Type
String
Example
// considering that today is 2021-11-08
lastDayOfTheMonth() // '2021-11-30'
lastDayOfTheMonth(12) // '2021-12-31'