Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

parse

import { parse } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Parse 11 February 2014 from middle-endian format:
var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
//=> Tue Feb 11 2014 00:00:00
@example
// Parse 28th of February in Esperanto locale in the context of 2010 year:
import eo from 'date-fns/locale/eo'
var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
  locale: eo
})
//=> Sun Feb 28 2010 00:00:00
function parse<DateType extends Date>(
dateStr: string,
formatStr: string,
referenceDate: DateType | number | string,
options?: ParseOptions,
): DateType;
§
parse<DateType extends Date>(dateStr: string, formatStr: string, referenceDate: DateType | number | string, options?: ParseOptions): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
dateStr: string
[src]
  • The string to parse
§
formatStr: string
[src]
  • The string of tokens
§
referenceDate: DateType | number | string
[src]
  • defines values missing from the parsed dateString

§Return Type

§
DateType
[src]

The parsed date