{"_id":"@aniky-wq/formatdatejs","_rev":"2-c438674baf3f6fd3593d4c84a25490ea","name":"@aniky-wq/formatdatejs","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@aniky-wq/formatdatejs","version":"1.0.0","author":{"name":"AnikY-wq"},"license":"MIT","_id":"@aniky-wq/formatdatejs@1.0.0","maintainers":[{"name":"aniky-wq","email":"aniketyelsalwar11@gmail.com"}],"dist":{"shasum":"33689bcced753bfd9d997d81fa29baa7d5cbc7ab","tarball":"https://registry.npmjs.org/@aniky-wq/formatdatejs/-/formatdatejs-1.0.0.tgz","fileCount":5,"integrity":"sha512-gPNtKLFdtEpxJK2MUyIO0izUdLH83uqAOE6rmCjJEoA/RfbxFmKGC1sa3MrSfRY9Sj3ru96RguHaz9/xt9GuVA==","signatures":[{"sig":"MEUCIE9QDXnJYOP17RRPYzgvZfln2u0KXaNUafawwoycSJcoAiEA/1lzzVhno0zxhbzK61i+68ff6HbiNO7C4LE9NRS6fv8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5007},"main":"index.js","gitHead":"7880294132a6b472e9eaeba8453cec62421e2cc2","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"aniky-wq","email":"aniketyelsalwar11@gmail.com"},"_npmVersion":"10.8.2","description":"A simple utitlity with date-time functions","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/formatdatejs_1.0.0_1748437691712_0.2919526593574906","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@aniky-wq/formatdatejs","version":"1.1.0","description":"A simple utitlity with date-time functions","main":"index.js","type":"module","exports":{".":"./index.js"},"repository":{"type":"git","url":"git+https://github.com/AnikY-wq/formatdatejs.git"},"keywords":["date","time","utility","format","javascript"],"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"AnikY-wq"},"license":"MIT","_id":"@aniky-wq/formatdatejs@1.1.0","gitHead":"e13d16d05b65c43eba0fdb1ed48af42a0a849644","bugs":{"url":"https://github.com/AnikY-wq/formatdatejs/issues"},"homepage":"https://github.com/AnikY-wq/formatdatejs#readme","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-qEV2F8eBwzdKihCFVd9JoYE4M4ZQR2zy+Bh0sIBiYeUC9CALJDaRoXox+fGUsq5YZTDN4F6/ZJ8lnqQC5zi1fg==","shasum":"51b08c084eb2549003a0e9eb8d19105742372095","tarball":"https://registry.npmjs.org/@aniky-wq/formatdatejs/-/formatdatejs-1.1.0.tgz","fileCount":5,"unpackedSize":5833,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDJzjgQIKT0iFmgncpvEccr1dta1hF0hL8d/0oHyKe2LwIgZVBARRqqA1rubUmNpfXmLH7qMO6cvuSx54GeCaDo4HA="}]},"_npmUser":{"name":"aniky-wq","email":"aniketyelsalwar11@gmail.com"},"directories":{},"maintainers":[{"name":"aniky-wq","email":"aniketyelsalwar11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/formatdatejs_1.1.0_1748505809751_0.49552431277110287"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-28T13:08:11.570Z","modified":"2025-05-29T08:03:30.055Z","1.0.0":"2025-05-28T13:08:11.900Z","1.1.0":"2025-05-29T08:03:29.898Z"},"author":{"name":"AnikY-wq"},"license":"MIT","description":"A simple utitlity with date-time functions","maintainers":[{"name":"aniky-wq","email":"aniketyelsalwar11@gmail.com"}],"readme":"# formatDateTime JS Utility\r\n\r\nA simple JavaScript utility function to format timestamps or dates into custom string formats.\r\n\r\n## Features\r\n\r\n- Format a timestamp or current date/time into a string.\r\n- Supports basic tokens: `YYYY`, `YY`, `MM`, `DD`, `hh`, `mm`, `ss`/`SS`.\r\n- Returns an empty string for invalid dates.\r\n\r\n## Usage\r\n\r\n### Import\r\n\r\n```js\r\nimport { formatDateTime } from \"@aniky-wq/formatdatejs\";\r\n// or, if using a relative path in your project:\r\n// import { formatDateTime } from './src/formatDateTime.js';\r\n```\r\n\r\n### Example\r\n\r\n```js\r\n// Format current date/time\r\nconst dateStr = formatDateTime({}); // Default: 'YYYY-MM-DD hh:mm:ss'\r\n\r\n// Format a specific timestamp\r\nconst timestamp = 1716902400000; // e.g., May 28, 2024\r\nconst formatted = formatDateTime({ timestamp, format: \"DD/MM/YYYY hh:mm:ss\" });\r\nconsole.log(formatted); // '28/05/2024 00:00:00'\r\n\r\n// Custom format\r\nformatDateTime({ timestamp: Date.now(), format: \"YY-MM-DD hh:mm\" }); // e.g., '25-05-28 14:30'\r\n```\r\n\r\n## API\r\n\r\n### formatDateTime({ timestamp, format })\r\n\r\n- `timestamp` (optional): The date/time to format (number, string, or Date). If omitted, uses the current date/time.\r\n- `format` (optional): The output format string. Default is `'YYYY-MM-DD hh:mm:ss'`.\r\n\r\n## Supported Format Tokens\r\n\r\n| Token | Description    | Example |\r\n| ----- | -------------- | ------- |\r\n| YYYY  | 4-digit year   | 2025    |\r\n| YY    | 2-digit year   | 25      |\r\n| MM    | Month (01-12)  | 05      |\r\n| DD    | Day (01-31)    | 28      |\r\n| hh    | Hour (00-23)   | 14      |\r\n| mm    | Minute (00-59) | 09      |\r\n| ss/SS | Second (00-59) | 07      |\r\n\r\n## Notes\r\n\r\n- If no timestamp is provided, the current date/time is used.\r\n- Returns an empty string for invalid timestamps.\r\n- Only supports a basic set of tokens (no AM/PM, day names, time zones, etc.).\r\n- No localization or custom token support.\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","homepage":"https://github.com/AnikY-wq/formatdatejs#readme","keywords":["date","time","utility","format","javascript"],"repository":{"type":"git","url":"git+https://github.com/AnikY-wq/formatdatejs.git"},"bugs":{"url":"https://github.com/AnikY-wq/formatdatejs/issues"}}