📝DateEx
The module that handles date and time operations.
Imports
Environment Variables
TZ
Time zone of the application.
Write .env
file with environment variable. Below has an example:
Method of Use
To use this module, you need to inject it into the desired service.
Injecting the module into our service.
With dependencies
You will need to inject the following interfaces.
IConfigurationService
IValidatorRegexpService
IStringExService
Properties
get now
public
Returns the current date and time.
get utc
public
Returns the current date and time in UTC.
get sevenDaysAgo
public
Returns the date with the subtraction of seven days.
get sevenDaysFromNow
public
Returns the date with the addition of seven days.
get oneMonthAgo
public
Returns the date with the subtraction of one month.
get oneMonthFromNow
public
Returns the date with the addition of one month.
get oneYearAgo
public
Returns the date with the subtraction of one year.
get oneYearFromNow
public
Returns the date with the addition of one year.
Methods
moment
public
Returns a new moment object, which is a wrapper for the Date object.
Last updated