Formats a given date as a simple YYYY-MM-DD string.

Type signature

(date: Date) => string

Examples

formatDate(
  new Date("2019-02-24T01:12:34")
);
// ⇒ "2019-02-24"
Try in REPL

Questions

  • How to render a date in a YYYY-MM-DD format?

TypeScript sourceJavaScript source