Skip to main content
Module

x/complaindate/mod.ts>ExtendedPlainDate

JavaScript date-time utilities that keep timezones on the surface
Latest
interface ExtendedPlainDate
implements ComPlainDate
import { type ExtendedPlainDate } from "https://deno.land/x/complaindate@v1.0.1/mod.ts";

Describes an extended plain-date object with extra properties and convenience methods for common operations, of which many are chainable.

Properties

toLocalInstant: (time?: { hour?: number | string; minute?: number | string; second?: number | string; millisecond?: number | string; }) => Date

Get a native JS Date object in the system's local timezone.

toInstant: (timezone: string, time?: { hour?: number | string; minute?: number | string; second?: number | string; millisecond?: number | string; }) => Date

Get a native JS Date object in a named timezone.

toLocaleStringMedium: (locale?: Intl.LocalesArgument) => string
toLocaleStringLong: (locale?: Intl.LocalesArgument) => string
toLocaleStringFull: (locale?: Intl.LocalesArgument) => string
dayName: (locale?: Intl.LocalesArgument) => string
dayNameShort: (locale?: Intl.LocalesArgument) => string
dayNameNarrow: (locale?: Intl.LocalesArgument) => string
monthName: (locale?: Intl.LocalesArgument) => string
monthNameShort: (locale?: Intl.LocalesArgument) => string
monthNameNarrow: (locale?: Intl.LocalesArgument) => string
ordinal: () => number

Day of the year (1-366)

quarter: () => QuarterNumber

Quarter of the year (1-4)

weekDayNumber: () => WeekDayNumber

ISO weekday number (1-7) starting with Monday

isBusinessDay: () => boolean

Monday to Friday

isWeekendDay: () => boolean

Saturday or Sunday

isFirstDayOfMonth: () => boolean
isLastDayOfMonth: () => boolean
isFirstDayOfYear: () => boolean
isLastDayOfYear: () => boolean
isInLeapYear: () => boolean
daysInMonth: () => number
daysInYear: () => number

Common years have 365 days, leap years have 366

addDays: (days: number) => this
addBusinessDays: (days: number) => this
addMonths: (months: number) => this
addQuarters: (quarters: number) => this
addYears: (years: number) => this
startOfBusinessWeek: () => this

Monday of the current week

startOfWeekend: () => this

Saturday of the current week

startOfMonth: () => this
startOfQuarter: () => this
startOfYear: () => this
firstMonday: () => this
firstTuesday: () => this
firstWednesday: () => this
firstThursday: () => this
firstFriday: () => this
firstSaturday: () => this
firstSunday: () => this
differenceInDays: (to: ComPlainDate) => number
differenceInBusinessDays: (to: ComPlainDate) => number
differenceInMonths: (to: ComPlainDate) => number
differenceInYears: (to: ComPlainDate) => number