{"id":22173229,"url":"https://github.com/litejs/date-format-lite","last_synced_at":"2025-07-26T15:31:24.215Z","repository":{"id":7435945,"uuid":"8774998","full_name":"litejs/date-format-lite","owner":"litejs","description":"Format, parse and manipulate dates in JavaScript","archived":false,"fork":false,"pushed_at":"2020-06-03T07:54:44.000Z","size":113,"stargazers_count":43,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-31T19:53:37.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.litejs.com/date-format-lite/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/litejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-14T12:44:14.000Z","updated_at":"2024-09-10T10:17:05.000Z","dependencies_parsed_at":"2022-08-29T13:40:20.148Z","dependency_job_id":null,"html_url":"https://github.com/litejs/date-format-lite","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litejs%2Fdate-format-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litejs%2Fdate-format-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litejs%2Fdate-format-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litejs%2Fdate-format-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litejs","download_url":"https://codeload.github.com/litejs/date-format-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227690324,"owners_count":17804875,"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-12-02T07:31:23.742Z","updated_at":"2024-12-02T07:31:26.782Z","avatar_url":"https://github.com/litejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[1]: https://secure.travis-ci.org/litejs/date-format-lite.png\n[2]: https://travis-ci.org/litejs/date-format-lite\n[3]: https://coveralls.io/repos/litejs/date-format-lite/badge.png\n[4]: https://coveralls.io/r/litejs/date-format-lite\n[tests]: https://raw.github.com/litejs/date-format-lite/master/tests/run.js \"tests/run.js\"\n\n\n    @version    17.7.0\n    @date       2017-07-14\n    @stability  2 - Unstable\n\n\nDate format \u0026ndash; [![Build][1]][2] [![Coverage][3]][4]\n===========\n\nA small library for parsing and formatting dates\nthat extends native Date object.\n\n\nInstall\n-------\n\nnpm install date-format-lite --save\n\n```javascript\nrequire(\"date-format-lite\")\n```\n\n\nFormat Dates\n------------\n\n`date-format-lite` adds `format(mask, [zone])` method to native `Date.prototype`.\n\n-   **mask** `String` - Output format, e.g. `hh:mm:ss`.\n-   **zone** `Number, optional` - UTC offset in hours, e.g. `-6.5`.\n\n```javascript\nvar now = new Date()          // Date {Wed Jul 10 2013 16:47:36 GMT+0300 (EEST)}\nnow.format(\"iso\")             // 2013-07-10T13:47:36Z\nnow.format(\"hh:mm\")           // 16:47 (local time)\nnow.format(\"UTC:hh:mm\")       // 13:47\nnow.format(\"hh:mm\", 2.5)      // 16:17\n```\n\nMutate  Dates\n------------\n\n`date-format-lite` adds `add(amount, [unit])` method to native `Date.prototype`.\n\n-   **amount** `Number` - Time to add, negative number will be subtracted.\n-   **unit** `String, optional` - e.g. seconds, minutes, hours, days, weeks, months, years.\n\n```javascript\nnow.format(\"iso\")                     // 2013-07-10T13:47:36Z\nnow.add(1, \"days\").format(\"iso\")      // 2013-07-11T13:47:36Z\nnow.add(-2, \"hours\").format(\"iso\")    // 2013-07-11T11:47:36Z\n```\n\nParse Dates\n-----------\n\n`date-format-lite` adds `date([outFormat], [outZone], [inZone])` method\nto native `String.prototype` and `Number.prototype`.\n\n-   **outFormat** `String, optional` - Output format, e.g. `hh:mm:ss`.\n    Returns date object when format not specified.\n-   **outZone** `Number, optional` - UTC offset for output in hours, e.g. `-6.5`.\n-   **inZone** `Number, optional` - UTC offset in input in hours, e.g. `-6.5`.\n\n```javascript\n\"2013-07-10\".date()           // Date {Wed Jul 10 2013 03:00:00 GMT+0300 (EEST)}\n\"2013-07-10T13:47:36Z\".date() // Date {Wed Jul 10 2013 16:47:36 GMT+0300 (EEST)}\n\"10/07/2013\".date()           // Date {Wed Jul 10 2013 03:00:00 GMT+0300 (EEST)}\nDate.middleEndian = true\n\"10/07/2013\".date()           // Date {Mon Oct 07 2013 03:00:00 GMT+0300 (EEST)}\n// Change format\n\"10/07/2013\".date(\"YYYY-MM-DD\")// 2013-07-10\n```\n\n\nAdd custom formats\n------------------\n\n```javascript\nDate.masks.my = '\"DayNo \"D'\nnow.format(\"my\")              // DayNo 10\n```\n\nChange default format\n---------------------\n\n```javascript\nDate.masks.default = 'YYYY-MM-DD hh:mm:ss'\nnow.format()         // 2013-07-10 13:47:36\n```\n\nChange language\n---------------\n\n```javascript\n// Add to estonian-lang.js\nDate.names = \"Jaan Veeb Märts Apr Mai Juuni Juuli Aug Sept Okt Nov Dets jaanuar veebruar märts aprill mai juuni juuli august september oktoober november detsember P E T K N R L pühapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev\".split(\" \")\n\n// Change AM and PM\nDate.am = \"a.m.\"\nDate.pm = \"p.m.\"\n```\n\n\nSee [tests][tests] for more examples\n\nSyntax\n------\n\n- **Y**     - A two digit representation of a year without leading zeros. Examples: 99 or 3\n- **YY**    - A two digit representation of a year. Examples: 99 or 03\n- **YYYY**  - A full numeric representation of a year, 4 digits. Examples: 1999 or 2003\n- **M**     - Numeric representation of a month, without leading zeros. 1 through 12\n- **MM**    - Numeric representation of a month, with leading zeros. 01 through 12\n- **MMM**   - A short textual representation of a month, three letters. Jan through Dec\n- **MMMM**  - A full textual representation of a month, such as January or March. January through December\n- **D**     - Day of the month without leading zeros. 1 to 31\n- **DD**    - Day of the month, 2 digits with leading zeros. 01 to 31\n- **DDD**   - A textual representation of a day, three letters. Mon through Sun\n- **DDDD**  - A full textual representation of the day of the week. Sunday through Saturday\n- **H**     - 12-hour format of an hour without leading zeros. 1 through 12\n- **HH**    - 12-hour format of an hour with leading zeros. 01 through 12\n- **h**     - 24-hour format of an hour without leading zeros. 0 through 23\n- **hh**    - 24-hour format of an hour with leading zeros. 00 through 23\n- **m**     - Minutes without leading zeros. 0 through 59\n- **mm**    - Minutes with leading zeros. 00 to 59\n- **s**     - Seconds without leading zeros. 0 through 59\n- **ss**    - Seconds with leading zeros. 00 to 59\n- **S**     - Milliseconds without leading zeros. 0 through 999\n- **SS**    - Milliseconds with leading zeros. 000 to 999\n- **U**     - Milliseconds since the Unix Epoch (January 1 1970 00:00:00 GMT)\n- **u**     - Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)\n- **A**     - Ante meridiem and Post meridiem. AM or PM\n- **\"text\"** - text, quotes should be escaped, eg '\"a \\\\\"quoted text\\\\\"\" YYYY'\n\n###### Time zone designators\n- **Z**     - Time offsets from UTC in the form ±hh[:mm] Examples: +02,    +02:30\n- **ZZ**    - Time offsets from UTC in the form ±hh[mm] Examples:  +02,    +0230\n- **ZZZ**   - Time offsets from UTC in the form ±hh:mm Examples:   +02:00, +02:30\n- **ZZZZ**  - Time offsets from UTC in the form ±hhmm Examples:    +0200,  +0230\n\n\n###### ISO-8601\n- **w**     - Day of the week. 1 (for Monday) through 7 (for Sunday)\n- **W**     - Week number of year, first week is the week with 4 January in it\n- **o**     - ISO-8601 year number. This has the same value as YYYY,\nexcept that if the ISO week number (W) belongs to the previous or next year,\nthat year is used instead\n\n### Notes\n\n- If no UTC relation information is given with a time representation, the time is assumed to be in local time.\n- If the time is in UTC, add a Z directly after the time without a space.\n\n### ToDo\n\n- [ ] Add timezone support for Date.format\n\n### Browser Support\n\nIt should work IE6 and up but automated testing is currently broken.\n\n\nLinks\n-----\n\n-   [Source-code on Github](https://github.com/litejs/date-format-lite)\n-   [Package on npm](https://npmjs.org/package/date-format-lite)\n\n### Licence\n\nCopyright (c) 2012-2016 Lauri Rooden \u0026lt;lauri@rooden.ee\u0026gt;  \n[The MIT License](http://lauri.rooden.ee/mit-license.txt)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitejs%2Fdate-format-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitejs%2Fdate-format-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitejs%2Fdate-format-lite/lists"}