{"id":19621366,"url":"https://github.com/commenthol/caldate","last_synced_at":"2025-04-28T03:32:18.195Z","repository":{"id":45068552,"uuid":"59179303","full_name":"commenthol/caldate","owner":"commenthol","description":"calendar date for date-holidays","archived":false,"fork":false,"pushed_at":"2023-05-11T06:24:57.000Z","size":40,"stargazers_count":1,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T05:54:33.019Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commenthol.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-19T06:19:22.000Z","updated_at":"2021-12-28T10:35:00.000Z","dependencies_parsed_at":"2024-06-18T21:14:13.909Z","dependency_job_id":"223a7b13-4658-42d9-bc3a-7a5e435ff996","html_url":"https://github.com/commenthol/caldate","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"53a78a50fc3a3aef65c2fde378a60a08be8016d0"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fcaldate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fcaldate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fcaldate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fcaldate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commenthol","download_url":"https://codeload.github.com/commenthol/caldate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246269,"owners_count":21558762,"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-11-11T11:22:40.954Z","updated_at":"2025-04-28T03:32:17.749Z","avatar_url":"https://github.com/commenthol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# caldate\n\n\u003e calendar date for date-holidays\n\n[![NPM version](https://badge.fury.io/js/caldate.svg)](https://www.npmjs.com/package/caldate/)\n[![Build Status](https://github.com/commenthol/caldate/workflows/CI/badge.svg?branch=master\u0026event=push)](https://github.com/commenthol/caldate/actions/workflows/ci.yml?query=branch%3Amaster)\n\n\n## Table of Contents\n\n\u003c!-- !toc (minlevel=2 omit=\"Table of Contents\") --\u003e\n\n* [Class: CalDate](#class-caldate)\n  * [new CalDate(opts)](#new-caldateopts)\n  * [CalDate.set(opts)](#caldatesetopts)\n  * [CalDate.isEqualDate(calDate)](#caldateisequaldatecaldate)\n  * [CalDate.getDay()](#caldategetday)\n  * [CalDate.setOffset(number, unit)](#caldatesetoffsetnumber-unit)\n  * [CalDate.setTime(hour, minute, second)](#caldatesettimehour-minute-second)\n  * [CalDate.setDuration(duration)](#caldatesetdurationduration)\n  * [CalDate.update()](#caldateupdate)\n  * [CalDate.toEndDate()](#caldatetoenddate)\n  * [CalDate.toTimezone(timezone)](#caldatetotimezonetimezone)\n  * [CalDate.toDate()](#caldatetodate)\n  * [CalDate.toISOString()](#caldatetoisostring)\n  * [CalDate.toString()](#caldatetostring)\n* [Contribution and License Agreement](#contribution-and-license-agreement)\n* [License](#license)\n* [References](#references)\n\n\u003c!-- toc! --\u003e\n\n## Class: CalDate\n\n### new CalDate(opts)\n\nconstructs a new CalDate instance\n\n**Parameters**\n\n**opts**: `Object | Date`, See `set(opts)`\n\n\n**Example**:\n```js\n// ES5\nimport CalDate from 'caldate'\n// cjs\nconst CalDate = require('caldate')\n\nconst caldate = new CalDate('2000-01-01 12:00:00')\ncaldate.year\n//\u003e 2000\ncaldate.month\n//\u003e 1\n```\n\n### CalDate.set(opts)\n\nset calendar date\n\n**Parameters**\n\n**opts**: `Object | Date`, defaults to `1900-01-01`\n\n**opts.year**: `String`, set calendar date\n\n**opts.month**: `String`, January equals to 1, December to 12\n\n**opts.day**: `String`, set calendar date\n\n**opts.hour**: `String`, set calendar date\n\n**opts.minute**: `String`, set calendar date\n\n**opts.second**: `String`, set calendar date\n\n**opts.duration**: `String`, defaults to 24 hours\n\n\n### CalDate.isEqualDate(calDate)\n\nchecks if Date is equal to `calDate`\n\n**Parameters**\n\n**calDate**: `CalDate`, checks if Date is equal to `calDate`\n\n**Returns**: `Boolean`, true if date matches\n\n### CalDate.getDay()\n\nget day of week\n\n**Returns**: `Number`, day of week 0=sunday, 1=monday, ...\n\n### CalDate.setOffset(number, unit)\n\nset offset per unit\n\n**Parameters**\n\n**number**: `Number`, set offset per unit\n\n**unit**: `String`, Unit in days `d`, hours `h, minutes `m`\n\n**Returns**: `Object`, this\n\n### CalDate.setTime(hour, minute, second)\n\nset time per hour, minute or second while maintaining duration at midnight\n\n**Parameters**\n\n**hour**: `Number`, set time per hour, minute or second while maintaining duration at midnight\n\n**minute**: `Number`, set time per hour, minute or second while maintaining duration at midnight\n\n**second**: `Number`, set time per hour, minute or second while maintaining duration at midnight\n\n**Returns**: `Object`, this\n\n### CalDate.setDuration(duration)\n\nset duration in hours\n\n**Parameters**\n\n**duration**: `Number`, in hours\n\n**Returns**: `Object`, this\n\n### CalDate.update()\n\nupdate internal data to real date\n\n**Returns**: `Object`, this\n\n### CalDate.toEndDate()\n\nget end date of calendar date\n\n**Returns**: `CalDate`\n\n### CalDate.toTimezone(timezone)\n\nmove internal date to a date in `timezone`\n\n**Parameters**\n\n**timezone**: `String`, e.g. 'America/New_York'\n\n**Returns**: `Date`\n\n### CalDate.fromTimezone(dateUTC, timezone)\n\nset date from a given `timezone`\n\n**Parameters**\n\n**dateUTC**: `Date`, date in UTC\n\n**timezone**: `String`, timezone of dateUTC, e.g. 'America/New_York'\n\n**Returns**: `CalDate` self\n\n### CalDate.toDate()\n\nconvert to Date\n\n**Returns**: `Date`\n\n### CalDate.toISOString()\n\nget Date in ISO format\n\n\n### CalDate.toString()\n\nget Date as String `YYYY-MM-DD HH:MM:SS`\n\n\n## Contribution and License Agreement\n\nIf you contribute code to this project, you are implicitly allowing your\ncode to be distributed under the ISC license. You are also implicitly\nverifying that all code is your original work or correctly attributed\nwith the source of its origin and licence.\n\n## License\n\nCopyright (c) 2016 commenthol ([ISC License](http://opensource.org/licenses/ISC))\n\nSee [LICENSE][] for more information.\n\n## References\n\n\u003c!-- !ref --\u003e\n\n* [LICENSE][LICENSE]\n\n\u003c!-- ref! --\u003e\n\n[LICENSE]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fcaldate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommenthol%2Fcaldate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fcaldate/lists"}