
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
date-to-iso-8601-string
Advanced tools
Presents a JavaScript `Date` as a string in [ISO 8601 format](https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf), with support for the Extended (`YYYY-MM-DD`) and Basic (`YYYYMMDD`) variants
Presents a JavaScript Date
as a string in ISO 8601 format, with support for the Extended (YYYY-MM-DD
) and Basic (YYYYMMDD
) variants.
Note that this module uses the "local date" in the time zone of the machine, rather than the UTC dfate.
This package includes TypeScript types.
# With npm
npm install --save date-to-iso-8601-string
# With Yarn
yarn add date-to-iso-8601-string
YYYY-MM-DD
format)// You can also import as a CommonJS module using `require`
import { dateToISO8601String } from 'date-to-iso-8601-string';
const date = new Date('2023-01-01');
dateToISO8601String(date);
//=> '2023-01-01'
YYYY-MM-DD
format)import { dateToISO8601String, ISO8601DateFormat } from 'date-to-iso-8601-string';
const date = new Date('2023-01-01');
dateToISO8601String(date, ISO8601DateFormat.Basic);
//=> '20230101'
src/
is written with Typescript.
dist/esm
) and CommonJS form (dist/commonjs
) by running npm run build
.npm
thanks to a prepublish
hook.npm run test
.npm run lint
, and automatically fix many failures with npm run lint-and-fix
.The compilation, testing and build process are automatically run on pushed code using GitHub Actions.
The following blog posts were very helpful for putting this - my first ever npm
package - together!:
FAQs
Presents a JavaScript `Date` as a string in [ISO 8601 format](https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf), with support for the Extended (`YYYY-MM-DD`) and Basic (`YYYYMMDD`) variants
We found that date-to-iso-8601-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.