Require
Import
import
Import using esm
or TypeScript
1.0.0
_f// => 14 Mar 2019 _f// => 03-07-2019 _f// => 03-05-2019
modules
Import individual ES Modules using esm
or TypeScript
1.0.0
// => 03-07-2019 // => 03-05-2019
Require
require
Import using require
1.0.0
const _f = _f// => 14 Mar 2019 _f// => 03-07-2019 _f// => 03-05-2019
“Date” Methods
_f.date(Date, format)
Computes input date
converts to string and returns with specified format
.
1.0.0
Date
(date): options are new Date()
, timestamp
or string
in valid date format. See example below.format
(string):(string): Returns the date as a String in specified format.
let any_fate = "1/07/2019" _f// => 01/07/2019 _f// => 01-07-2019 _f// => 01.07.2019 _f// => Jan 07 2019 _f// => 07 Jan 2019 _f// => 07 Jan 2019 _f// => Mon Jan 07 2019 00:00:00 GMT-0700 (Mountain Standard Time)
_f.now()
Gets the timestamp of the number of milliseconds that have elapsed since
the Unix epoch (1 January 1970 00
:00:00 UTC).
1.0.0
(number): Returns the timestamp.
const defer = // => Logs milliseconds it took for the deferred invocation.
_f.getTimestamp(Date)
Gets the timestamp of the number of milliseconds that have elapsed since
date
argument. If date
is undefined
it gives milliseconds elapsed since
the Unix epoch (1 January 1970 00
:00:00 UTC).
1.0.0
Date
(date): to convert to timestamp.(number): Returns the timestamp.
_f// => 121244400000 _f// => 1552353178563// returns now timestamp _f// => -6106035604000
_f.isDate(value)
Verifies if value
is a valid Date object
and valid Date
.
1.0.0
value
(*): The value to check.(boolean): Returns true
if value
is a Date object
& valid Date
, else false
.
_f// => true _f// => true _f// => true _f// => true _f// => false { return '1/1/19'}_f// => false _f// => true
“Math” Methods
_f.addDays(Date, days, format)
Input _fate
add nDays
with format
1.0.0
Date
(date):days
(number): to addformat
(string):const any_fate = '3/6/19' _f// => 03-07-2019 _f// => 03.08.2019 _f// => 09 Mar 2019
_f.subtractDays(Date, days, format)
Input _fate
subtract nDays
with format
1.0.0
Date
(Date):days
(number): to subtractformat
(string):const any_fate = '3/6/19' _f// => 03-05-2019 _f// => 03.04.2019 _f// => 03 Mar 2019