{"id":19068823,"url":"https://github.com/cutenode/temporalts","last_synced_at":"2025-10-12T18:45:32.283Z","repository":{"id":36932379,"uuid":"231304256","full_name":"cutenode/temporalts","owner":"cutenode","description":"A library to convey temporal information about Node.js LTS release lines.","archived":false,"fork":false,"pushed_at":"2022-12-30T19:27:44.000Z","size":68,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T21:51:50.814Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cutenode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-02T03:57:03.000Z","updated_at":"2021-07-17T13:13:01.000Z","dependencies_parsed_at":"2023-01-17T07:18:56.104Z","dependency_job_id":null,"html_url":"https://github.com/cutenode/temporalts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cutenode%2Ftemporalts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cutenode%2Ftemporalts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cutenode%2Ftemporalts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cutenode%2Ftemporalts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cutenode","download_url":"https://codeload.github.com/cutenode/temporalts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240122476,"owners_count":19751140,"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-09T01:12:08.956Z","updated_at":"2025-10-12T18:45:27.245Z","avatar_url":"https://github.com/cutenode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# temporalts\n\ntemporalts is a module that leverages [Moment](https://www.npmjs.com/package/moment) (apologies, Maggie!) and the [schedule.json](https://github.com/nodejs/Release/blob/master/schedule.json) file published in the Node.js Release WG repo to generate temporal information about Node.js release lines.\n\n## Installation\n\n```\nnpm install temporalts\n```\n\n## Usage\n\ntemporalts can pass all Node.js LTS release line temporal information, or the temporal information for a _specific_ release line.\n\n### `temporalts()`\n\nReturns `Promise\u003cObject\u003e` -  an object where each key is the name of a release line and the property of each key is an object that includes several instances of Moment and some additional useful information that is derived from those instances of Moment.\n\nExample:\n```js\nconst temporalts = require('temporalts')\n\nasync function timeUntilEachLineGoesEOL() {\n  const lts = await temporalts()\n\n    for (let [key, ltsTime] of Object.entries(lts)) {\n      console.log(`One percent of the Node.js ${key} LTS release line's lifespan is ${ltsTime.onePercentOfLTSLifeSpanInDays} days.`)\n    }\n}\n\ntimeUntilEachLineGoesEOL()\n```\n\n### `temporalts(version)` (release line temporal information for `version`)\n\n* `version` String - A string representing a maintained release line format. Must be in a recognizable version format, or an error will be thrown.\n  * Valid examples for Node.js' `v12` release line would include: `v12`, `12`, `v12.x`, `12.x.y`, `12.x`, or `v12.x.y`.\n\nReturns `Promise\u003cObject\u003e` - resolves an Object containing the following properties:\n  - `now`: An instance of `moment()` which is the current moment in time.\n  - `timeframeStart`: An instance of `moment` that is the beginning of the LTS window of a given release's lifespan.\n    - **Important:** This is *not* the original release of the LTS release line as Current, but rather the moment it moved from Current to LTS.\n  - `timeframeEnd`: An instance of `moment` that is the moment a given release line goes End of Life (EOL).\n  - `diffStartAndEnd`: Difference (in milliseconds) between `timeframeStart` and `timeframeEnd`.\n  - `diffNowAndStart`: Difference (in milliseconds) between `now` and `timeframeStart`.\n  - `diffNowAndEnd`: Difference (in milliseconds) between `now` and `timeframeEnd`.\n  - `onePercentOfLTSLifeSpanInMilliseconds`: A calculation (in milliseconds) of 1% of the lifespan of a given release.\n  - `onePercentOfLTSLifeSpanInDays`: A calculation (in days) of 1% of the lifespan of a given release.\n  - `currentPercentOfLTSLifeSpan`: Gives the raw (including decimal) percentage of time that has passed from the beginning to the end of a given release's LTS lifespan.\n  - `currentPercentOfLTSLifeSpanWithoutDecimal`: Gives the more human-friendly (exclusing decimal) percentage of time that has passed from the beginning to the end of a given release's LTS lifespan.\n  - `currentPercentOfLTSLifeSpanAsProgressBar`: Proives a progress bar (using the charachters `[`, `=`, ` `, and `]`) that shows the current progress of a given release's lifespan in a visual format.\n  - `fromNowToEnd`: Human-readable time from now to the end of the LTS window.\n  - `fromLTSStartToNow`: Human-readable time from the start of the LTS window to now.\n\nBelow is an example of **of one entry**. You will get several of these as properties of their respective versions as keys if you execute the module without passing a version.\n\n```json\n{\n    \"now\": \"2020-01-02T03:44:02.171Z\",\n    \"timeframeStart\": \"2018-10-30T04:00:00.000Z\",\n    \"timeframeEnd\": \"2021-04-30T04:00:00.000Z\",\n    \"diffStartAndEnd\": 78883200000,\n    \"diffNowAndStart\": 37064642171,\n    \"diffNowAndEnd\": 41818557829,\n    \"onePercentOfLTSLifeSpanInMilliseconds\": 788832000,\n    \"onePercentOfLTSLifeSpanInDays\": 9.13,\n    \"currentPercentOfLTSLifeSpan\": 46.98673757023042,\n    \"currentPercentOfLTSLifeSpanWithoutDecimal\": 46,\n    \"currentPercentOfLTSLifeSpanAsProgressBar\": \"[=========           ]\",\n    \"fromNowToEnd\": \"in a year\",\n    \"fromLTSStartToNow\": \"a year ago\"\n}\n```   \n\n- You must only pass versions that map to an LTS release line. In Node.js, all even versions were, are, or will be LTS release lines.\n- Data will only be returned for versions that exist in the [`schedule.json`](https://github.com/nodejs/Release/blob/master/schedule.json) file the Node.js Release WG maintains.\n  - Generally, this is 1 LTS ahead of the currently published version that _is_ or _will be_ an LTS version.\n\nExample:\n```js\nconst temporalts = require('../')\n\nasync function prettyPrint () {\n  const version = 'v12'\n  const data = await temporalts(version)\n\n  const percentDecimal = data.currentPercentOfLTSLifeSpanWithoutDecimal\n  const percentProgress = data.currentPercentOfLTSLifeSpanAsProgressBar\n  console.log(`We are ${percent}% through the lifespan of the Node.js ${version} LTS release line.\\n`)\n  console.log(percentProgress)\n}\n\nprettyPrint()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcutenode%2Ftemporalts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcutenode%2Ftemporalts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcutenode%2Ftemporalts/lists"}