graphql-kit / graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.
MIT License
2.69k stars 225 forks source link

feat(core): Add dateInRange fake #203

Open adamlesniak opened 11 months ago

adamlesniak commented 11 months ago

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"
      ]
    }
  }
}