Fake.REST logo
Fake.REST
Topics
Getting started
Dynamic templating
Scripting

Date

Date namespace contains methods that generate strings related to the date entity.

Template definitions

{{date.today()}} - Generates today's date.


{{date.randomDate()}} - Generates randomly date it's could be as in the past as in the future, e.g "Wed Jan 25 2040 22:36:09 GMT+0300 (GMT+03:00)".


{{date.futureAny()}} - Generates randomly the date in the future.


{{date.pastAny()}} - Generates randomly the date in the past.


{{date.recent()}} - Generates randomly the recent date.


{{date.month()}} - Generates randomly the name of the month, e.g. "March".


{{date.weekday()}} - Generates randomly the week day, e.g. "Monday".


The example of template usage:

{
  "someDateSample": {
    "today": "{{date.today()}}",
    "recent": "{{date.recent()}}",
    "randomDate": "{{date.randomDate()}}",
    "futureAny": "{{date.futureAny()}}",
    "pastAny": "{{date.pastAny()}}",
    "month": "{{date.month()}}",
    "weekday": "{{date.weekday()}}"
  }
}