{"id":15354947,"url":"https://github.com/capaj/proxy-date","last_synced_at":"2025-04-15T06:20:45.936Z","repository":{"id":34038854,"uuid":"166401133","full_name":"capaj/proxy-date","owner":"capaj","description":"a minimal clean utility for mocking Date in any environment featuring ES6 Proxy ","archived":false,"fork":false,"pushed_at":"2023-01-04T21:38:37.000Z","size":880,"stargazers_count":11,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-06T09:42:47.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/capaj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-18T12:23:43.000Z","updated_at":"2024-03-22T02:02:27.000Z","dependencies_parsed_at":"2023-01-15T04:07:59.222Z","dependency_job_id":null,"html_url":"https://github.com/capaj/proxy-date","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/capaj%2Fproxy-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fproxy-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fproxy-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fproxy-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/proxy-date/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249017267,"owners_count":21198936,"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":[],"created_at":"2024-10-01T12:21:46.606Z","updated_at":"2025-04-15T06:20:45.921Z","avatar_url":"https://github.com/capaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/proxy-date.svg)](https://badge.fury.io/js/proxy-date)\n[![deps](https://david-dm.org/capaj/proxy-date.svg)](https://david-dm.org/capaj/proxy-date)\n\n# proxy-date\n\na minimal utility for painless mocking Date in node.js and Proxy enabled browsers\n\n![gif](https://media.giphy.com/media/l4hLT6kXPi9js7xFC/giphy.gif)\n\n## Why yet another Date mocking library?\n\nYes there is plenty of them already out there(timekeeper, mockdate atc.), but this one is the only one using proxies. What's so special about proxies? It only intercepts the constructor and `.now()`. There is no monkeypatching globals like with all the other libraries. Which means any other code relying on `Date.constructor` for example won't get affected by this.\nThe only downside is this only works for node.js 6 and up.\n\n## Install\n\n```\npnpm i proxy-date -D\n```\n\n## Usage\n\n```js\nimport { mockDate, unmockDate } from 'proxy-date'\n\nmockDate('2020-01-19T00:20:20.654Z')\nnew Date().toISOString() //2019-01-19T00:20:20.654Z\n\nunmockDate()\nnew Date().toISOString() // now\n```\n\nI like to use this with jest's snapshot tests to ensure I don't have to manually write matchers for every date that happens to occur in a snapshot.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fproxy-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fproxy-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fproxy-date/lists"}