{"id":19714698,"url":"https://github.com/quavedev/custom-type-date-time","last_synced_at":"2026-05-15T09:12:57.111Z","repository":{"id":119413433,"uuid":"264920653","full_name":"quavedev/custom-type-date-time","owner":"quavedev","description":"Meteor package that provides a data time type for GraphQL and EJSON","archived":false,"fork":false,"pushed_at":"2020-06-28T14:04:49.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T14:59:47.836Z","etag":null,"topics":["custom-type","ejson","meteor","meteor-package"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quavedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-18T11:37:59.000Z","updated_at":"2020-06-24T07:17:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"61e3389b-11e1-47ef-bd7b-938fbbc71868","html_url":"https://github.com/quavedev/custom-type-date-time","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quavedev%2Fcustom-type-date-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quavedev%2Fcustom-type-date-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quavedev%2Fcustom-type-date-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quavedev%2Fcustom-type-date-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quavedev","download_url":"https://codeload.github.com/quavedev/custom-type-date-time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241035831,"owners_count":19898082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-type","ejson","meteor","meteor-package"],"created_at":"2024-11-11T22:34:59.409Z","updated_at":"2026-05-15T09:12:57.051Z","avatar_url":"https://github.com/quavedev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quave:custom-type-date-time\n\n`quave:custom-type-date-time` is a Meteor package that provides a date time type for GraphQL and EJSON.\n\n## Why\n\nIt is desired to have the correct type automatically in the client and in the server without manual transformation.\n\nWe believe we are not reinventing the wheel in this package but what we are doing is like putting together the wheels in the vehicle :).\n\n## Installation\n\n```sh\nmeteor add quave:custom-type-date-time\n```\n\n## Usage\n\n### GraphQL Server\n\nYou register the resolver and the definition itself in the schema.\n\n```javascript\nimport { DateTimeResolver } from 'meteor/quave:custom-type-date-time/DateTimeResolver';\nimport { DateTimeDefinition } from 'meteor/quave:custom-type-date-time/DateTimeDefinition';\n\nstartGraphQLServer({\n  typeDefs: [\n    DateTimeDefinition,\n  ],\n  resolvers: [\n    DateTimeResolver,\n  ],\n});\n\n```\n\n### Model Definition\n\nYou define a field with this type.\n\n```javascript\nimport { createModelDefinition } from 'meteor/quave:definitions';\nimport { DateTimeType } from 'meteor/quave:custom-type-date-time/DateTimeType';\n\nexport const PlayerDefinition = createModelDefinition({\n  name: 'Player',\n  fields: {\n    name: {\n      type: String,\n    },\n    birthday: {\n      type: DateTimeType,\n      optional: true,\n    },\n  },\n});\n```\n\n### Client\n\nYou register this type in the client as well then it's going to work with EJSON.\n\n```javascript\nimport { DateTimeType } from 'meteor/quave:custom-type-date-time/DateTimeType';\n\nDateTimeType.register();\n```\n\n### Ready\n\nNow you can use your type anywhere you want, see one example with React.\n\n```javascript\nimport { DateTime } from 'meteor/quave:custom-type-date-time/DateTime';\nimport { PlayerDefinition } from '../players/PlayersDefinitions';\n\n// Component\nconst Form = () =\u003e {\n  // other hooks\n  const [birthday, setBirthday] = useState(undefined);\n\n  const edit = player =\u003e {\n    cancel();\n    setId(player._id);\n    setName(player.name);\n    setBirthday(player.birthday.formatDate());\n  };\n\n  const save = () =\u003e {\n    const player = {\n      _id,\n      name,\n      birthday: DateTime.parseDate(birthday),\n    };\n\n    savePlayer({\n      variables: {\n        player,\n      },\n      refetchQueries: () =\u003e [PlayerDefinition.graphQLManyQueryName],\n    }).then(() =\u003e cancel());\n  };\n\n  // ... return component\n}\n```\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquavedev%2Fcustom-type-date-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquavedev%2Fcustom-type-date-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquavedev%2Fcustom-type-date-time/lists"}