Methods
(inner) dateFromObjectId(objectId, formatopt) → {String|Number}
Convert a Mongo ObjectID to a Date Object or a Date String depending on format param
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
objectId |
ObjectID
|
object id to transform |
|
format |
dateFormatType
|
<optional> |
if undefined return Date object |
Returns:
- Type:
-
String
|Number
formatted date string or timestamp in ms
(inner) daysInMonth(month, year) → {Number}
Get the number of days in a month
- Source:
Parameters:
Name | Type | Description |
---|---|---|
month |
Number
|
from 0 to 11 |
year |
Number
|
from 1970 YYYY format |
Returns:
- Type:
-
Number
Number of days in the request moth
(inner) getFirstDayOfTheMonth(month, year) → {Date}
Get the a Date object of the first day in specified month
- Source:
Parameters:
Name | Type | Description |
---|---|---|
month |
Number
|
from 0 to 11 |
year |
Number
|
from 1970 YYYY format |
Returns:
- Type:
-
Date
Date
(inner) getLastDayOfTheMonth(month, year) → {Date}
Get the a Date object of the last day in specified month
- Source:
Parameters:
Name | Type | Description |
---|---|---|
month |
Number
|
from 0 to 11 |
year |
Number
|
from 1970 YYYY format |
Returns:
- Type:
-
Date
Date
(inner) timeAgo(time, options) → {String}
Returns a date or a timestamp to elapsed time format
- Source:
Parameters:
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
time |
Date
|
Number
|
|||||||||
options |
Object
|
template property allow you to use different string for all time frames, prefix, and suffix
|
Returns:
- Type:
-
String
formatted time ago
Type Definitions
formatObject
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
locale |
String
|
country locale |
|
options |
Object.<string, string>
|
<optional> |
toLocaleDateString format object |
- Source:
templates
Properties:
Name | Type | Description |
---|---|---|
prefix |
string
|
|
suffix |
string
|
|
seconds |
string
|
|
minute |
string
|
|
minutes |
string
|
|
hour |
string
|
|
hours |
string
|
|
day |
string
|
|
days |
string
|
|
month |
string
|
|
months |
string
|
|
year |
string
|
|
years |
string
|
- Source:
Type:
-
Object