{"id":20614887,"url":"https://github.com/dashed/dayofweek","last_synced_at":"2026-06-01T04:31:38.436Z","repository":{"id":66030606,"uuid":"104315796","full_name":"dashed/dayofweek","owner":"dashed","description":"Port of dayofweek function given by Tomohiko Sakamoto on the comp.lang.c Usenet newsgroup in 1993.","archived":false,"fork":false,"pushed_at":"2019-04-12T23:14:55.000Z","size":679,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T18:50:22.404Z","etag":null,"topics":["date","day","dayofweek","javascript","week"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dashed.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":"2017-09-21T07:28:31.000Z","updated_at":"2019-02-23T04:14:16.000Z","dependencies_parsed_at":"2023-03-10T23:33:42.844Z","dependency_job_id":null,"html_url":"https://github.com/dashed/dayofweek","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dashed/dayofweek","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Fdayofweek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Fdayofweek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Fdayofweek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Fdayofweek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashed","download_url":"https://codeload.github.com/dashed/dayofweek/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Fdayofweek/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33760645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"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":["date","day","dayofweek","javascript","week"],"created_at":"2024-11-16T11:13:49.380Z","updated_at":"2026-06-01T04:31:38.430Z","avatar_url":"https://github.com/dashed.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"dayofweek [![Build Status](https://travis-ci.org/dashed/dayofweek.svg)](https://travis-ci.org/dashed/dayofweek) [![npm version](https://img.shields.io/npm/v/dayofweek.svg?style=flat)](https://www.npmjs.com/package/dayofweek)\n=========\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/dashed/dayofweek.svg)](https://greenkeeper.io/)\n\n\u003e Get the day of the week given year, month, and day.\n\u003e\n\u003e Port of dayofweek function given by Tomohiko Sakamoto on the comp.lang.c Usenet newsgroup\n\u003e into JavaScript.\n\u003e\n\u003e See: https://groups.google.com/forum/#!msg/comp.lang.c/m4YG7Uw72Ic/WQj-pRNzJaIJ\n\n\nHow it works: https://www.quora.com/How-does-Tomohiko-Sakamotos-Algorithm-work\n\n## Install\n\n```sh\n$ yarn add dayofweek\n# npm v5+\n$ npm install dayofweek\n# before npm v5\n$ npm install --save dayofweek\n```\n\n## Usage\n\n```js\nconst dayofweek = require('dayofweek');\n\n// API\n// dayofweek(year, month, day[, translate = true])\n\n// Invariants as per Tomohiko Sakamoto's original implementation.\n// * year \u003e 1752\n// * 1 \u003c= month \u003c= 12\n// * 1 \u003c= day \u003c= 31\n\n// By default returns days of the week.\ndayofweek(2017, 6, 16);\ndayofweek(2017, 6, 16, true);\ndayofweek(2017, 6, 16, 'long');\n// → Friday\n\n// Setting translate = 'short' will return shorthand form of the days of the week.\ndayofweek(2017, 6, 16, 'short');\n// → Fri\n\n// Setting translate = false will return an integer representation of the day of the week.\n// i.e. 0=Sun, 1=Mon, ..., 6=Sat\ndayofweek(2017, 6, 16, false);\n// → 5\n\n// You can pass a translate function. This function will be given the integer\n// representation of the day of the week. See above.\ndayofweek(2017, 6, 16,\n    day_index =\u003e\n        // days of the week in Spanish\n        [\n            \"lunes\",\n            \"martes\",\n            \"miércoles\",\n            \"jueves\",\n            \"viernes\",\n            \"sábado\",\n            \"domingo\"\n        ][day_index]\n);\n// → sábado\n\n// Or you can pass an array.\ndayofweek(2017, 6, 16,\n    // days of the week in Spanish\n    [\"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\", \"domingo\"]\n);\n// → sábado\n```\n\nLicense\n=======\n\nPublic Domain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Fdayofweek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashed%2Fdayofweek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Fdayofweek/lists"}