new NowHelper()

Description

Defines and registers custom handlebar helper - now

Methods


register() → {void}

Description

Registers now helper

  • If now helper is called without a format, set a default format as YYYY-MM-DD hh:mm:ss else use the format provided
  • Set default offset to be used if offset is not specified. Default offset is 0s i.e. no offset
  • If offset is defined the value will be stored in context.hash.offset, eg X days.
  • Split value by a space, first element will be the amount of offset i.e. X, second element will be unit of offset, i.e. days
  • Return a value with specified format and added offset
Returns