Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/complaindate/support/dateParts.ts>dateParts

JavaScript date-time utilities that keep timezones on the surface
Latest
function dateParts
import { dateParts } from "https://deno.land/x/complaindate@v1.0.1/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