{"id":13620966,"url":"https://github.com/masbagal/tempe","last_synced_at":"2025-04-14T22:33:08.067Z","repository":{"id":38427190,"uuid":"235567823","full_name":"masbagal/tempe","owner":"masbagal","description":"Featherlight (\u003c 2kB) helper for Javascript date formatting","archived":false,"fork":false,"pushed_at":"2023-01-07T04:30:20.000Z","size":1026,"stargazers_count":83,"open_issues_count":8,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T19:08:23.934Z","etag":null,"topics":["date","date-formatting","i18n","javascript","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tempe","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/masbagal.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}},"created_at":"2020-01-22T12:22:19.000Z","updated_at":"2024-04-05T14:35:47.000Z","dependencies_parsed_at":"2023-02-06T11:46:34.604Z","dependency_job_id":null,"html_url":"https://github.com/masbagal/tempe","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/masbagal%2Ftempe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masbagal%2Ftempe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masbagal%2Ftempe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masbagal%2Ftempe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masbagal","download_url":"https://codeload.github.com/masbagal/tempe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248897559,"owners_count":21179611,"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","date-formatting","i18n","javascript","typescript"],"created_at":"2024-08-01T21:01:01.285Z","updated_at":"2025-04-14T22:33:03.057Z","avatar_url":"https://github.com/masbagal.png","language":"TypeScript","funding_links":[],"categories":["Packages","T","Open Source Project"],"sub_categories":["Date","Utility"],"readme":"\n\u003ccenter\u003e\n\u003cimg src='logo/tempe.png' height='120' align=\"center\" alt='Tempe Logo' /\u003e\n\n\n\u003e Featherlight (2kB) helper for Javascript date formatting\n\n[![min](https://img.shields.io/bundlephobia/min/tempe)](https://bundlephobia.com/result?p=tempe) [![min](https://img.shields.io/bundlephobia/minzip/tempe)](https://bundlephobia.com/result?p=tempe)\n\u003c/center\u003e\n\n\nSometimes all you need is just a simple date formatting without all of those super powers.\n\nName is a play from [tempus](https://en.wikipedia.org/wiki/Tempus), Latin word meaning time  and [tempe](https://en.wikipedia.org/wiki/Tempeh) an Indonesian traditional food.\n\n\n## 📦 Install\n\n```\n$ yarn add tempe\n\n or\n\n$ npm install tempe --save\n```\n\n## 💻 Usage\nUse the default export, pass existing date object or you can initialize it like normal Javascript Date object.\n\n```js\nimport tempe from 'tempe';\n\n// use tempe as Date initializer\ntempe(2020, 0, 13).format('dd, DD MMM YYYY'); // \"Monday, 13 Jan 2020\"\n\n// pass existing Date object to tempe\ntempe(new Date(2020, 0, 13)).format('dd, DD MMM YYYY'); // \"Monday, 13 Jan 2020\"\n\n// time formatting\ntempe(2020, 2, 25, 23, 59).format('DD MMMM YYYY hh:mm:ss'); // \"25 March 2020 23:59:00\"\ntempe(2020, 2, 25, 23, 59).format('H at DD/MM/YYYY'); // \"11 PM at 25/03/2020\"\n\n```\n\n## 🌐 i18n\nTempe supports internationalization by specifying the locale while formatting\n\n```js\nimport tempe from 'tempe';\n\ntempe(2020, 5, 13).format('DD MMM YYYY', 'ja'); // \"13日 6月 2020年\"\ntempe(2020, 5, 13).format('DD MMM YYYY', 'vi'); // \"13 Tháng 6 2020\"\ntempe(2020, 5, 13).format('DD MMM YYYY', 'id'); // \"13 Juni 2020\"\n\n```\n\n### Calendar Types\n\nMeanwhile, some locale have their own default calendar type. For example, if you're using a Thailand locale it will generate a Buddhist calendar that show a different year than standard gregorian calendar.\n```js\ntempe(2020, 5, 13).format('DD MMM YYYY', 'th'); // 13 มิถุนายน พ.ศ. 2563\n```\n\nYou can change it by providing the calendar type in the third optional parameter of `format()` function.\n\n```js\n// change calendar type to gregorian\ntempe(2020, 5, 13).format('DD MMM YYYY', 'th', 'gregory' ); // 13 มิถุนายน พ.ศ. 2020\n\n// change calendar type to islamic\ntempe(2020, 5, 13).format('DD MMM YYYY', 'id', 'islamic' ); // 22 Syawal 1441 H\n\n```\n\nPossible values for this parameter includes: \n- `\"buddhist\"`\n- `\"chinese\"`\n- `\"coptic\"`\n- `\"ethiopia\"`\n- `\"ethiopic\"`\n- `\"gregory\"`\n- `\"hebrew\"`\n- `\"indian\"`\n- `\"islamic\"`\n- `\"iso8601\"`\n- `\"japanese\"`\n- `\"persian\"`\n- `\"roc\"`\n\nThis is an optional parameter. By leaving this parameter empty, the date will be generated using the default type of provided locale.\n\n\n## 📝 List of all available formats\n\n| Format | Output           | Description                           |\n| ------ | ---------------- | ------------------------------------- |\n| `YY`   | 18               | Two-digit year                        |\n| `YYYY` | 2018             | Four-digit year                       |\n| `M`    | 1-12             | The month, beginning at 1             |\n| `MM`   | 01-12            | The month, 2-digits                   |\n| `MMM`  | Jan-Dec          | The abbreviated month name            |\n| `MMMM` | January-December | The full month name                   |\n| `D`    | 1-31             | The day of the month                  |\n| `DD`   | 01-31            | The day of the month, 2-digits        |\n| `dd`   | Sun-Sat            | The short name of the day of the week   |\n| `ddd` | Sunday-Saturday  | The name of the day of the week       |\n| `H`    | 0-23 AM/PM            | The hour with AM/PM                             |\n| `HH`    | 0-23 AM/PM            | The hour with AM/PM                             |\n| `h`    | 01-12             | The hour, 12-hour clock               |\n| `hh`   | 01-12            | The hour, 12-hour clock     |\n| `m`    | 0-59             | The minute                            |\n| `mm`   | 00-59            | The minute, 2-digits                  |\n| `s`    | 0-59             | The second                            |\n| `ss`   | 00-59            | The second, 2-digits                  |\n\n---\n\nThis project was bootstrapped with [TSDX](https://github.com/jaredpalmer/tsdx).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasbagal%2Ftempe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasbagal%2Ftempe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasbagal%2Ftempe/lists"}