{"id":22691145,"url":"https://github.com/radiovisual/pendel","last_synced_at":"2025-03-29T16:41:17.653Z","repository":{"id":57321925,"uuid":"42209367","full_name":"radiovisual/pendel","owner":"radiovisual","description":"Get the time difference between two date strings or two time strings.","archived":false,"fork":false,"pushed_at":"2017-10-30T12:17:00.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T17:50:21.955Z","etag":null,"topics":["date","difference","time"],"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/radiovisual.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-09T23:04:01.000Z","updated_at":"2022-03-19T15:30:57.000Z","dependencies_parsed_at":"2022-08-25T22:41:53.560Z","dependency_job_id":null,"html_url":"https://github.com/radiovisual/pendel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiovisual%2Fpendel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiovisual%2Fpendel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiovisual%2Fpendel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiovisual%2Fpendel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radiovisual","download_url":"https://codeload.github.com/radiovisual/pendel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246215825,"owners_count":20741894,"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":["date","difference","time"],"created_at":"2024-12-10T01:09:32.259Z","updated_at":"2025-03-29T16:41:17.615Z","avatar_url":"https://github.com/radiovisual.png","language":"JavaScript","readme":"# pendel [![Build Status](https://travis-ci.org/radiovisual/pendel.svg)](https://travis-ci.org/radiovisual/pendel)\n\n\u003e Get the time difference between two date strings or two time strings.\n\n**[Pendel](https://de.wikipedia.org/wiki/Pendel):** German word for pendulum.\n\n## v3.0\n\nVersion 3.0 allows you to pass in fully-qualified datetime strings to both\n`pendel.date()` and `pendel.time()`. Per the v2.0 API, you can still pass in 12-hour\nand 24-hour clocktime strings to `pendel.time()`.\n\n## Install\n\n```\n$ npm install --save pendel\n```\n\n\n## Usage\n\n```js\nconst duration = require('pendel');\n\n// Difference in CLOCK TIMES via pendel.time()\nduration.time('2:00PM', '5:30PM');\nduration.time('14:00', '17:30');\nduration.time('Mon Jan 01 2001 14:00:00 GMT+0000 (WET)', 'Mon Jan 01 2001 17:30:00 GMT+0000 (WET)');\n/*\n  {\n    hours: 3,\n    minutes: 30,\n    seconds: 0,\n    totalSeconds: 12600,\n    totalMinutes: 210\n  }\n*/\n\n// Difference in CALENDAR DATES via pendel.date()\nduration.date('Mon Jan 01 2001 00:00:00 GMT+0000 (WET)', 'Thu, 03 Jan 2002 00:00:00 GMT');\nduration.date('01/01/01', '01/03/02');\n/*\n  { years: 1,\n    months: 12,\n    weeks: 52,\n    days: 367,\n    hours: 8808,\n    minutes: 528480,\n    seconds: 31708800\n  }\n*/\n```\n\n\n## API\n\n### `pendel.time(startTime, endTime)`\n\nGet the time difference between `startTime` and `endTime`.\n\nReturns an `object` with the following time properties:\n\nProperty | Description\n:--- | :---\n`hours` | The difference in hours\n`minutes` | The difference in minutes\n`seconds` | The difference in seconds\n`totalSeconds` | The total elapsed time in seconds\n`totalMinutes` | The total elapsed time in minutes\n\n\n#### startTime\n\nType: `string`  \n\nA datestring or clocktime string.\n\n\n#### endTime\n\nType: `string`\n\nA datestring or clocktime string.\n\n**Note:** `startTime` \u0026 `endTime` recognize any of the following formats\nto be 12-hour or 24-hour clocktime string:\n\n12-hour formats: *(space after time optional)*\n\n- `1:00 AM`\n- `1:00AM`\n- `1:00:00 AM`\n- `1:00:00AM`\n\n24-hour formats:\n\n- `00:00`\n- `00:00:00`\n\n\n### `pendel.date(startDate, endDate)`\n\nGet the elapsed (delta) time between startDate and endDate\n\nReturns an `object` with the following Date properties:\n\nProperty | Description\n:--- | :---\n`years` | The difference in years\n`months` | The difference in months\n`weeks` | The difference in weeks\n`days` | The total elapsed time in days\n`hours` | The total elapsed time in hours\n`minutes` | The total elapsed time in minutes\n`seconds` | The total elapsed time in seconds\n\n\n#### startDate\n\nType: `string` | `Date`\n\nThe datestring or Date object you want to use as the start date.\n\n\n#### endDate\n\nType: `string` | `Date`\n\nThe datestring or Date object you want to use as the end date.\n\n\n## License\n\nMIT @ [Michael Wuergler](http://www.numetriclabs.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradiovisual%2Fpendel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradiovisual%2Fpendel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradiovisual%2Fpendel/lists"}