{"_id":"tinydate","_rev":"902116","name":"tinydate","description":"A tiny (349B) reusable date formatter. Extremely fast!","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"time":{"modified":"2021-09-20T12:28:16.000Z","created":"2017-04-26T22:49:41.665Z","1.3.0":"2020-06-29T17:40:59.525Z","1.2.0":"2019-07-29T21:48:24.120Z","1.1.0":"2019-06-04T00:22:04.322Z","1.0.1":"2019-01-25T21:40:51.910Z","1.0.0":"2017-05-02T01:16:06.113Z","0.0.0":"2017-04-26T22:49:41.665Z"},"users":{"ahmedelgabri":true,"d3ck":true},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"versions":{"1.3.0":{"name":"tinydate","version":"1.3.0","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"description":"A tiny (349B) reusable date formatter. Extremely fast!","unpkg":"dist/tinydate.min.js","module":"dist/tinydate.mjs","main":"dist/tinydate.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=4"},"scripts":{"build":"bundt","bench":"node bench","prebench":"npm run build","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":["date","datestamp","format","stamp","time","timestamp","time-stamp"],"devDependencies":{"bundt":"0.4.0","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"d4c65e0f67dc94cdffd1328e42ea2effcb973db0","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@1.3.0","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"shasum":"e6ca8e5a22b51bb4ea1c3a2a4fd1352dbd4c57fb","size":3453,"noattachment":false,"key":"/tinydate/-/tinydate-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-1.3.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tinydate_1.3.0_1593452459210_0.8366803490511694"},"_hasShrinkwrap":false,"publish_time":1593452459525,"_cnpm_publish_time":1593452459525},"1.2.0":{"name":"tinydate","version":"1.2.0","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"description":"A tiny (349B) reusable date formatter. Extremely fast!","unpkg":"dist/tinydate.min.js","module":"dist/tinydate.mjs","main":"dist/tinydate.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"build":"bundt","bench":"node bench","prebench":"npm run build","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":["date","datestamp","format","stamp","time","timestamp","time-stamp"],"devDependencies":{"bundt":"0.4.0","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"bd242cfdd63b8567741b4415bcfbcb703c822617","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"36b4bb02715f89743f3ef9073d3573d005a28d0e","size":3280,"noattachment":false,"key":"/tinydate/-/tinydate-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-1.2.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tinydate_1.2.0_1564436903841_0.5220221213398786"},"_hasShrinkwrap":false,"publish_time":1564436904120,"_cnpm_publish_time":1564436904120},"1.1.0":{"name":"tinydate","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"description":"A tiny (340B) reusable date formatter. Extremely fast!","unpkg":"dist/tinydate.min.js","module":"dist/tinydate.mjs","main":"dist/tinydate.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"build":"bundt","bench":"node bench","prebench":"npm run build","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":["date","datestamp","format","stamp","time","timestamp","time-stamp"],"devDependencies":{"bundt":"^0.4.0","tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"3517322919c9b3e58fd436a77387ce105c9f887c","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"730ef3073e6e1ccdcff074368464f494290a4fd9","size":2851,"noattachment":false,"key":"/tinydate/-/tinydate-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-1.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tinydate_1.1.0_1559607724211_0.03979886693488388"},"_hasShrinkwrap":false,"publish_time":1559607724322,"_cnpm_publish_time":1559607724322},"1.0.1":{"name":"tinydate","version":"1.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"description":"A tiny (332B) reusable date formatter. Extremely fast!","unpkg":"dist/tinydate.min.js","module":"dist/tinydate.mjs","main":"dist/tinydate.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"build":"bundt","bench":"node bench","prebench":"npm run build","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":["date","datestamp","format","stamp","time","timestamp","time-stamp"],"devDependencies":{"bundt":"^0.2.0","tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"08349b7c3a973efa61009848df4dcc55f6056d7b","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"5e38797e2e3e79ce2300543f586c6caa2dfcf668","size":2870,"noattachment":false,"key":"/tinydate/-/tinydate-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-1.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tinydate_1.0.1_1548452451776_0.847992470160456"},"_hasShrinkwrap":false,"publish_time":1548452451910,"_cnpm_publish_time":1548452451910},"1.0.0":{"name":"tinydate","version":"1.0.0","description":"A tiny (337B) reusable date formatter. Extremely fast!","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"module":"dist/tinydate.es.js","main":"dist/tinydate.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"bench":"node bench","build":"node builder","prebench":"npm run build","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"files":["dist"],"keywords":["date","datestamp","format","stamp","time","timestamp","time-stamp"],"dependencies":{},"devDependencies":{"gzip-size":"^3.0.0","pretty-bytes":"^4.0.2","tap-spec":"^4.1.1","tape":"^4.6.3","uglify-js":"^2.8.22"},"gitHead":"b9b632c9861a4bd547f4de43923c5d256241fc30","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@1.0.0","_shasum":"20f31756a13959ef8c57ec133ba29b5ade042cac","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"20f31756a13959ef8c57ec133ba29b5ade042cac","size":2771,"noattachment":false,"key":"/tinydate/-/tinydate-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-1.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/tinydate-1.0.0.tgz_1493687764401_0.3191234713885933"},"directories":{},"publish_time":1493687766113,"_hasShrinkwrap":false,"_cnpm_publish_time":1493687766113},"0.0.0":{"name":"tinydate","version":"0.0.0","description":"A tiny, reusable date formatter.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/lukeed/tinydate.git"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && tape test/*.js | tap-spec"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3","xo":"^0.16.0"},"xo":{"esnext":true},"gitHead":"7919bd7e6c2db49a3332352c892d1cee93c8a8e4","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"homepage":"https://github.com/lukeed/tinydate#readme","_id":"tinydate@0.0.0","_shasum":"eed4f7ff9f6b46efa4d3a23baabffd583f896df9","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"eed4f7ff9f6b46efa4d3a23baabffd583f896df9","size":1553,"noattachment":false,"key":"/tinydate/-/tinydate-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tinydate/download/tinydate-0.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/tinydate-0.0.0.tgz_1493246981409_0.06019389652647078"},"directories":{},"publish_time":1493246981665,"_hasShrinkwrap":false,"_cnpm_publish_time":1493246981665}},"readme":"# tinydate ![CI](https://github.com/lukeed/tinydate/workflows/CI/badge.svg)\n\n> A tiny (349B) reusable date formatter. Extremely fast!\n\n[Demo](https://jsfiddle.net/lukeed/aoy0xeze/)\n\nInspired by [`tinytime`][tinytime], this module returns a \"render\" function that efficiently re-render your deconstructed template. This allows for [incredibly performant](#benchmarks) results!\n\nHowever, please notice that this only provides a [limited subset of Date methods](#patterns).<br>\nIf you need more, [`tinytime`][tinytime] or [`date-fns`](https://github.com/date-fns/date-fns) are great alternatives!\n\n## Install\n\n```\n$ npm install --save tinydate\n```\n\n\n## Usage\n\n```js\nconst tinydate = require('tinydate');\nconst fooDate = new Date('5/1/2017, 4:30:09 PM');\n\nconst stamp = tinydate('Current time: [{HH}:{mm}:{ss}]');\n\nstamp(fooDate);\n//=> Current time: [16:30:09]\n\nstamp();\n//=> Current time: [17:09:34]\n```\n\n\n## API\n\n### tinydate(pattern, dict?)(date?)\nReturns: `Function`\n\nReturns a rendering function that will optionally accept a [`date`](#date) value as its only argument.\n\n#### pattern\nType: `String`<br>\nRequired: `true`\n\nThe template pattern to be parsed.\n\n#### dict\nType: `Object`<br>\nRequired: `false`\n\nA custom dictionary of template patterns. You may override [existing patterns](#patterns) or declare new ones.\n\n> **Important:** All dictionary items **must be a function** and must control its own formatting.<br>For example, when defining your own `{ss}` template, `tinydate` **will not** pad its value to two digits.\n\n```js\nconst today = new Date('2019-07-04, 5:30:00 PM');\n\n// Example custom dictionary:\n//   - Adds {MMMM}\n//   - Overrides {DD}\nconst stamp = tinydate('Today is: {MMMM} {DD}, {YYYY}', {\n\tMMMM: d => d.toLocaleString('default', { month: 'long' }),\n\tDD: d => d.getDate()\n});\n\nstamp(today);\n//=> 'Today is: July 4, 2019'\n```\n\n#### date\nType: `Date`<br>\nDefault: `new Date()`\n\nThe date from which to retrieve values. Defaults to current datetime if no value is provided.\n\n\n## Patterns\n\n- `{YYYY}`: full year; eg: **2017**\n- `{YY}`: short year; eg: **17**\n- `{MM}`: month; eg: **04**\n- `{DD}`: day; eg: **01**\n- `{HH}`: hours; eg: **06** (24h)\n- `{mm}`: minutes; eg: **59**\n- `{ss}`: seconds; eg: **09**\n- `{fff}`: milliseconds; eg: **555**\n\n\n## Benchmarks\n\n```\n# Node v10.13.0\n\ntinydate    x 160,834,214 ops/sec ±0.21% (96 runs sampled)\ntinytime    x  44,602,162 ops/sec ±0.34% (97 runs sampled)\ntime-stamp  x     888,153 ops/sec ±1.27% (86 runs sampled)\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n\n[tinytime]: https://github.com/aweary/tinytime\n","_attachments":{},"homepage":"https://github.com/lukeed/tinydate#readme","bugs":{"url":"https://github.com/lukeed/tinydate/issues"},"license":"MIT"}