get
function get(unit: TimeUnit): number
Returns the value of unit
as a number.
const now = new Chronosis()
// Retrieves the current month
const month = now.get('month')
note
If you need a way to retrive the name of a unit (e.g. July or Monday), see format
.
Edge Cases
If unit
isn't a valid TimeUnit
, this function returns undefined
.
const undef = now.get('invalid')