{"id":15663278,"url":"https://github.com/joseluisq/timelite","last_synced_at":"2025-05-05T23:49:41.177Z","repository":{"id":71953724,"uuid":"121179366","full_name":"joseluisq/timelite","owner":"joseluisq","description":"String date and time utilities :clock10:","archived":false,"fork":false,"pushed_at":"2020-05-11T09:19:33.000Z","size":259,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T01:26:17.904Z","etag":null,"topics":["date","format","helpers","sanitize","string-date","string-time","time","utilities"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/joseluisq.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,"governance":null}},"created_at":"2018-02-11T23:50:29.000Z","updated_at":"2024-10-12T18:53:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"5557ecb1-3ccf-4211-9f51-217ca4db2de8","html_url":"https://github.com/joseluisq/timelite","commit_stats":{"total_commits":53,"total_committers":4,"mean_commits":13.25,"dds":"0.24528301886792447","last_synced_commit":"2819fc74b2e569f07a7ac6ac5f1c97a24e5f84de"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Ftimelite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Ftimelite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Ftimelite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Ftimelite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joseluisq","download_url":"https://codeload.github.com/joseluisq/timelite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596366,"owners_count":21773843,"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","format","helpers","sanitize","string-date","string-time","time","utilities"],"created_at":"2024-10-03T13:36:19.229Z","updated_at":"2025-05-05T23:49:41.157Z","avatar_url":"https://github.com/joseluisq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timelite [![Build Status](https://travis-ci.com/joseluisq/timelite.svg?branch=master)](https://travis-ci.com/joseluisq/timelite) [![npm](https://img.shields.io/npm/v/timelite.svg)](https://www.npmjs.com/package/timelite) [![npm](https://img.shields.io/npm/dt/timelite.svg)](https://www.npmjs.com/package/timelite) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\u003e String date and time utilities. :clock10:\n\n## Overview\n\n__Timelite__ works in the top of [Datetime Strings (ISO 8601)](https://es.wikipedia.org/wiki/ISO_8601), receiving one array of string datetimes and returning one array of [Unsigned Datetime Integers](https://en.wikipedia.org/wiki/Signedness). This makes it a portable, compact and faster library if you are probably thinking about [why not around Date](https://codeofmatt.com/javascript-date-type-is-horribly-broken/).\n\n## API\n\nFor now, the API is quite limited but feel free to contribute.\n\n__Time__\n\n- [x] `add` : Add an array of string times. E.g. `add(['04:20:10', '21:15:10'])` =\u003e `[ 25, 35, 2 ]`\n- [x] `str` : Format an array of time values into string time. E.g. `str([12, 10, 45])` =\u003e `12:10:45`\n- [x] `sub` : Subtract an array of string times. E.g. `sub(['20:40:10', '20:10:50'])` =\u003e `[ 0, 29, 20 ]`\n\n__Date__\n\n- [x] `normalize` : Normalize string date values returning a valid date as an unsigned integer array. E.g. `normalize('0-02-31')` =\u003e `[ 2000, 2, 28 ]`\n- [x] `str` : Format an array date values into a valid string date. E.g. `str([0, 0, 0])` =\u003e `'2000-01-01'`\n\n## Install\n\n[Yarn](https://github.com/yarnpkg/)\n\n```sh\nyarn add timelite\n```\n\n[NPM](https://www.npmjs.com/)\n\n```sh\nnpm install timelite\n```\n\n[UMD](https://github.com/umdjs/umd/) file is also available on [unpkg](https://unpkg.com):\n\n```html\n\u003cscript src=\"https://unpkg.com/timelite/timelite.umd.min.js\"\u003e\u003c/script\u003e\n```\n\nYou can use the library via `window.timelite`.\n\n## Usage\n\n### Time\n\n#### add\n\nAdd an array of string time values \"HH:mm:ss\".\n\n```js\nimport { add } from 'timelite/time'\n\nadd(['04:20:10', '21:15:10'])\n// [ 25, 35, 2 ]\nadd(['04:35:10', '21:35:10'])\n// [ 26, 10, 2 ]\nadd(['30:59', '17:10'])\n// [ 48, 09, 0 ]\nadd(['19:30:00', '00:30:00'])\n// [ 20, 00, 0 ]\n```\n\n#### sub\n\nSubtract an array of string time values \"HH:mm:ss\".\n\n```js\nimport { sub } from 'timelite/time'\n\nsub(['20:40:10', '20:10:50'])\n// [ 0, 29, 20 ]\nsub(['20:05:10', '10:10:50'])\n// [ 9, 54, 20 ]\n```\n\n#### str\n\nFormat an array time values into string time.\n\n```js\nimport { str } from 'timelite/time'\n\nstr([12, 10, 45])\n// \"12:10:45\"\nstr([5, 1, 0])\n// \"05:01:00\"\nstr([7, 22])\n// \"07:22:00\"\n```\n\n### Date\n\n#### normalize\n\nNormalize string date values returning a valid date as an unsigned integer array.\n\n```js\nimport { normalize } from 'timelite/date'\n\nnormalize('1980-09-02')\n// [ 1980, 9, 2 ]\nnormalize('17')\n// [ 2017, 1, 1 ]\nnormalize('18-04')\n// [ 2018, 4, 1 ]\nnormalize('0-02-31')\n// [ 2000, 2, 28 ]\n```\n\n#### str\n\nFormat an array date values into a valid string date.\n\n```js\nimport { str } from 'timelite/date'\n\nstr([ 0, 0, 0 ])\n// 2000-01-01\nstr([ 17, 14, 5 ])\n// 2017-12-05\nstr([ 1988, 2 ])\n// 1988-02-01\n```\n\n## Contributions\n\nFeel free to send some [Pull request](https://github.com/joseluisq/timelite/pulls) or [issue](https://github.com/joseluisq/timelite/issues).\n\n## License\nMIT license\n\n© 2018-present [Jose Quintana](http://git.io/joseluisq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Ftimelite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoseluisq%2Ftimelite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Ftimelite/lists"}