Skip to content

feat(core): Add dateInRange fake#203

Open
adamlesniak wants to merge 1 commit intoAPIs-guru:mainfrom
adamlesniak:main
Open

feat(core): Add dateInRange fake#203
adamlesniak wants to merge 1 commit intoAPIs-guru:mainfrom
adamlesniak:main

Conversation

@adamlesniak
Copy link

@adamlesniak adamlesniak commented Nov 5, 2023

  • Adds in dateInRange fake - this allows developer to customize the returned date.
  • Updates the default value of string to reflect faker word.
  • Update docker version to match package.json - error when building.

Example usage:

type Employee {
  id: ID
  firstName: String @fake(type: firstName, locale: en_CA)
  lastName: String @fake(type: lastName, locale: en_CA)
  address: String @fake(type: streetAddress, options: { useFullAddress: true })
  subordinates: [Employee!] @listLength(min: 0, max: 3)
  company: Company
  workDates: [String!]
    @fake(
      type: dateInRange
      options: {
        dateFrom: "2023-11-05T16:56:52.372Z"
        dateTo: "2023-11-15T16:56:52.372Z",
        dateFormat: "YYYY-MM-DD"
      }
    )
}
{
  employee(id: "test") {
    workDates
  }
}
{
  "data": {
    "employee": {
      "workDates": [
        "2023-11-05",
        "2023-11-06",
        "2023-11-07",
        "2023-11-08",
        "2023-11-09",
        "2023-11-10",
        "2023-11-11",
        "2023-11-12",
        "2023-11-13",
        "2023-11-14"
      ]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant