Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/complaindate/support/dateParts.ts>dateParts

JavaScript date-time utilities that keeps timezones on the surface
Go to Latest
function dateParts
import { dateParts } from "https://deno.land/x/complaindate@v0.7.2/support/dateParts.ts";

Extract year, month & day from an ISO 8601 string representation of a date.

yyyy-mm-dd & yyyy-mm are the most common formats, but others are handled too.

  • Handles negative years
  • Ignores any time or timezone information in the given string

Parameters

isoDateString: string

A string containing an ISO 8601 date

Returns

{ year: number; month: number; day?: number; } | null

An object containing year, month & day properties extracted from the string