{"id":28089355,"url":"https://github.com/nodeguy/server-date","last_synced_at":"2025-12-12T05:02:20.560Z","repository":{"id":47158219,"uuid":"5408989","full_name":"NodeGuy/server-date","owner":"NodeGuy","description":"Make the server's clock available in the browser.","archived":false,"fork":false,"pushed_at":"2023-07-03T04:51:16.000Z","size":269,"stargazers_count":194,"open_issues_count":6,"forks_count":53,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-07T04:05:56.899Z","etag":null,"topics":["clock","date","javascript","server"],"latest_commit_sha":null,"homepage":"http://www.nodeguy.com/serverdate/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NodeGuy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2012-08-14T05:57:42.000Z","updated_at":"2025-02-01T14:41:57.000Z","dependencies_parsed_at":"2024-06-19T09:53:36.024Z","dependency_job_id":"316887e9-48bb-4e24-8ae2-b2490ece2e58","html_url":"https://github.com/NodeGuy/server-date","commit_stats":{"total_commits":81,"total_committers":11,"mean_commits":7.363636363636363,"dds":0.5679012345679013,"last_synced_commit":"361c97c0ce13b3c931aa79e7bcc321718e642f32"},"previous_names":["nodeguy/serverdate"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NodeGuy%2Fserver-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NodeGuy%2Fserver-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NodeGuy%2Fserver-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NodeGuy%2Fserver-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NodeGuy","download_url":"https://codeload.github.com/NodeGuy/server-date/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948349,"owners_count":21988953,"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":["clock","date","javascript","server"],"created_at":"2025-05-13T12:57:32.624Z","updated_at":"2025-12-12T05:02:15.285Z","avatar_url":"https://github.com/NodeGuy.png","language":"JavaScript","readme":"# Changes\n\nThis version has been rewritten and breaks compatibility with the previous API.\n\n# Introduction\n\nserver-date makes the server's clock available to the client's web browser in\nJavaScript.\n\nYou can use it when you want to display the current time but don't trust the\nbrowser's clock to be accurate or to synchronize events for different users of\nyour web site by syncing them all to the server's clock.\n\n`serverDate.js`, gets the time\nfrom the server on which the library is hosted by reading the\n[Date](https://tools.ietf.org/html/rfc7231#section-7.1.1.2) HTTP response\nheader. You don't need to make any changes on the server if you use this version\nbut its precision is limited to seconds because that's what's available in the\nheader.\n\n## Usage\n\n```JavaScript\nimport { getServerDate } from \"./serverDate.js\";\n\nconst { date, offset, uncertainty } = await getServerDate();\n\nconsole.log(`The server's date is ${date} +/- ${uncertainty} milliseconds.`);\n\n// some time in the future\n\nconst serverDate = new Date(Date.now() + offset);\n```\n\nSee `example.html` for a complete example.\n\n# References\n\n- Cristian, Flaviu (1989), \"Probabilistic clock synchronization\", Distributed\n  Computing (Springer) 3 (3): 146–158, DOI:10.1007/BF01784024\n- MikeWyatt's answer and Willem Mulder's comment in [Sync JS time between\n  multiple devices](http://stackoverflow.com/questions/10585910/sync-js-time-between-multiple-devices)\n- Rob W's answer to [How to synchronise a client webpage timer with the server](http://stackoverflow.com/questions/9350928/how-to-synchronise-a-client-webpage-timer-with-the-server)\n\n# Copyright\n\nCopyright 2012 David Braun\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeguy%2Fserver-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodeguy%2Fserver-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeguy%2Fserver-date/lists"}