{"id":16260048,"url":"https://github.com/cludden/ajv-moment","last_synced_at":"2025-10-14T06:10:01.160Z","repository":{"id":9995400,"uuid":"64039320","full_name":"cludden/ajv-moment","owner":"cludden","description":"robust date validation for json-schema","archived":false,"fork":false,"pushed_at":"2022-12-02T20:55:49.000Z","size":673,"stargazers_count":12,"open_issues_count":14,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T19:05:53.756Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cludden.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-23T22:59:11.000Z","updated_at":"2020-12-06T05:07:28.000Z","dependencies_parsed_at":"2022-08-07T05:15:22.128Z","dependency_job_id":null,"html_url":"https://github.com/cludden/ajv-moment","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/cludden/ajv-moment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fajv-moment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fajv-moment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fajv-moment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fajv-moment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cludden","download_url":"https://codeload.github.com/cludden/ajv-moment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fajv-moment/sbom","scorecard":{"id":293641,"data":{"date":"2025-08-11","repo":{"name":"github.com/cludden/ajv-moment","commit":"cd9edfdb19f096ede5b78f0b56eec12c6942c6ad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 5/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"50 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-7xcx-6wjh-7xp2","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T18:55:51.901Z","repository_id":9995400,"created_at":"2025-08-17T18:55:51.901Z","updated_at":"2025-08-17T18:55:51.901Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018121,"owners_count":26086280,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-10T16:06:08.482Z","updated_at":"2025-10-14T06:10:01.144Z","avatar_url":"https://github.com/cludden.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ajv-moment\nan [ajv](https://github.com/epoberezkin/ajv) plugin using [moment](https://github.com/moment/moment/) for robust date validation in your json-schemas.\n\n\n\n## Installing\n```bash\nnpm install --save ajv moment ajv-moment\n```\n\n\n\n## Getting Started\n```javascript\nimport Ajv from 'ajv'\nimport { plugin } from 'ajv-moment'\nimport moment from 'moment'\n\n// define an ajv instance\nconst ajv = new Ajv();\n\n// install the plugin. by default, this plugin utilizes the \"moment\" custom keyword\nplugin({ ajv, moment });\n\n// define your schemas using the \"moment\" keyword\n// here we define a schema for an object with two keys (assigned \u0026 due)\n// each of which must be a valid date string in ISO 8601 format.\n// in addition, we specify that the due key must be greater than or\n// equal to the assigned date plus 3 days.\nconst schema = {\n    type: 'object',\n    properties: {\n        assigned: {\n            type: 'string',\n            moment: true\n        },\n        due: {\n            type: 'string',\n            moment: {\n                validate: [{\n                    test: 'isSameOrAfter',\n                    value: {\n                        $data: '1/assigned',\n                        manipulate: [{\n                            add: [3, 'days']\n                        }]\n                    }\n                }]\n            }\n        }\n    },\n    required: [\n        'assigned', 'due'\n    ]\n}\n\n// compile your schema using ajv\nconst validate = ajv.compile(schema);\n\nvalidate({\n    assigned: new Date().toISOString(),\n    due: moment().add(24, 'hours').toISOString()\n});\n// false\n\nvalidate({\n    assigned: new Date().toISOString(),\n    due: moment().add(1, 'weeks').toISOString()\n});\n// true\n```\n\n\n\n## Schemas\nThe custom keyword schema definitions can take on many forms. The simplest being the following:\n\n```json\n{\n    \"type\": \"string\",\n    \"description\": \"a valid date string in ISO 8601 format\",\n    \"moment\": true\n}\n```\n\nThis schema will simply enforce that the provided value is a valid date string in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.\n\nTo specify a custom format, a `format` option can be defined in the schema definition. When a custom format is specified, moment's `strict` parsing option will be enforced.\n\n```json\n{\n    \"type\": \"string\",\n    \"description\": \"a valid date string in MM-DD-YYYY format\",\n    \"moment\": {\n        \"format\": [\"MM-DD-YYYY\"]\n    }\n}\n```\n\nAside from date string formats, this plugin can also perform additional validations using `moment`. The validations are defined in the `validate` subschema keyword and can be used to enforce relative constraints on date strings. See below for some examples.\n\n```json\n[\n    {\n        \"type\": \"string\",\n        \"description\": \"a valid date string prior to January 1st, 2000 UTC\",\n        \"moment\": {\n            \"validate\": [\n                {\n                    \"test\": \"isBefore\",\n                    \"value\": \"2000-01-01T00:00:00.000Z\"\n                }\n            ]\n        }\n    },\n    {\n        \"type\": \"object\",\n        \"properties\": {\n            \"assigned\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string in ISO 8601 format\",\n                \"moment\": true\n            },\n            \"due\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string in ISO 8601 format that is greater than or equal to the assigned date plus 3 days \u0026 30 minutes\",\n                \"moment\": {\n                    \"validate\": [\n                        {\n                            \"test\": \"isSameOrAfter\",\n                            \"value\": {\n                                \"$data\": \"1/assigned\",\n                                \"manipulate\": [\n                                    {\n                                        \"add\": [3, \"days\"]\n                                    },\n                                    {\n                                        \"add\": [30, \"minutes\"]\n                                    }\n                                ]\n                            }\n                        }\n                    ]\n                }\n            }\n        },\n        \"required\": [\n            \"assigned\",\n            \"due\"\n        ]\n    },\n    {\n        \"type\": \"object\",\n        \"properties\": {\n            \"first\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string in ISO 8601 format\",\n                \"moment\": true\n            },\n            \"second\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string in ISO 8601 format that is greater than the 'first' attribute by at least 30 minutes\",\n                \"moment\": {\n                    \"validate\": [\n                        {\n                            \"test\": \"isSameOrAfter\",\n                            \"value\": {\n                                \"$data\": \"1/first\",\n                                \"manipulate\": [\n                                    {\n                                        \"add\": [30, \"minutes\"]\n                                    }\n                                ]\n                            }\n                        }\n                    ]\n                }\n            },\n            \"breakpoint\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string in ISO 8601 format that is both between 'first' and 'second' and also prior to 'second' by at least 15 seconds\",\n                \"moment\": {\n                    \"validate\": [\n                        {\n                            \"test\": \"isBetween\",\n                            \"value\": [\n                                {\n                                    \"$data\": \"1/first\"\n                                },\n                                {\n                                    \"$data\": \"1/second\"\n                                }\n                            ]\n                        },\n                        {\n                            \"test\": \"isSameOrBefore\",\n                            \"value\": {\n                                \"$data\": \"1/second\",\n                                \"manipulate\": [\n                                    {\n                                        \"subtract\": [15, \"seconds\"]\n                                    }\n                                ]\n                            }\n                        }\n                    ]\n                }\n            },\n            \"third\": {\n                \"type\": \"string\",\n                \"description\": \"a valid date string prior in ISO 8601 format that after 'second'\",\n                \"moment\": {\n                    \"validate\": [\n                        {\n                            \"test\": \"isAfter\",\n                            \"value\": {\n                                \"$data\": \"1/second\"\n                            }\n                        }\n                    ]\n                }\n            }\n        },\n        \"required\": [\n            \"first\",\n            \"second\",\n            \"breakpoint\",\n            \"third\"\n        ]\n    }\n]\n```\n\n\n\n## Testing\nrun all tests  \n```javascript\nnpm test\n```\n\n\n\n## Contributing\n1. [Fork it](https://github.com/cludden/ajv-moment/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n\n## License\nCopyright (c) 2016 Chris Ludden.\nLicensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Fajv-moment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcludden%2Fajv-moment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Fajv-moment/lists"}