{"id":21356597,"url":"https://github.com/timruffles/periods","last_synced_at":"2025-08-20T12:43:35.339Z","repository":{"id":26139080,"uuid":"29584090","full_name":"timruffles/periods","owner":"timruffles","description":null,"archived":false,"fork":false,"pushed_at":"2015-01-21T10:46:59.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T13:16:34.262Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timruffles.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}},"created_at":"2015-01-21T10:16:30.000Z","updated_at":"2021-06-08T09:44:26.000Z","dependencies_parsed_at":"2022-07-25T11:02:06.304Z","dependency_job_id":null,"html_url":"https://github.com/timruffles/periods","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timruffles/periods","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timruffles%2Fperiods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timruffles%2Fperiods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timruffles%2Fperiods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timruffles%2Fperiods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timruffles","download_url":"https://codeload.github.com/timruffles/periods/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timruffles%2Fperiods/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271321233,"owners_count":24739472,"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-08-20T02:00:09.606Z","response_time":69,"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-11-22T04:33:57.144Z","updated_at":"2025-08-20T12:43:35.260Z","avatar_url":"https://github.com/timruffles.png","language":"JavaScript","readme":"# Periods\n\nDefined time-periods constants for Javascript, in milliseconds. Exposed as functions to make mis-typing fail noisily, rather than manifesting as `NaN`s in your data.\n\n```javascript\nvar periods = require(\"periods\");\n\nvar twentyFourHoursLater = Date.now() + periods.day();\n\nvar week = periods.week;\n\nvar durations = [1,2,3];\nvar weekDurations = durations.map(week);\n```\n\nWorks in browser too.\n\n## Methods\n\nEach method has a plural defined. e.g `seconds()`, `monthsRough()`\n\n### `second(n = 1)`\n\nn * 1000\n\n### `minute(n = 1)`\n\nn * 60 * second\n\n### `hour(n = 1)`\n\nn * 60 * minute\n\n### `day(n = 1)`\n\nn * 24 * hour\n\n### `week(n = 1)`\n\nn * 7 * day\n\n### `monthRough(n = 1)`\n\nn * 4.3 * week\n\n### `yearRough(n = 1)`\n\nn * 365.25 * day\n\n","funding_links":[],"categories":["模块","Modules"],"sub_categories":["日期和时间","Date \u0026 Time"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimruffles%2Fperiods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimruffles%2Fperiods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimruffles%2Fperiods/lists"}