Skip to main content

MonthDay

ฦฌ MonthDay: Format["--MM-DD"] & string

A Iso.MonthDay represents a particular day on the calendar, but without a year. For example, it could be used to represent a yearly recurring event, like "Bastille Day is on the 14th of July."

If you need to refer to a certain instance of a calendar event, in a particular year, use Iso.Date or even Iso.DateTime. A Iso.MonthDay can be converted into a Iso.Date by combining it with a year, using the toDate() method.

Defined in

iso-types.ts:111

fromNumbers

โ–ธ fromNumbers(month, day): MonthDay

Parameters

NameType
monthnumber
daynumber

Returns

MonthDay

Defined in

types/IMonthDayFns.ts:6


isValid

โ–ธ isValid(monthDay): monthDay is MonthDay

Parameters

NameType
monthDayunknown

Returns

monthDay is MonthDay

Defined in

types/IMonthDayFns.ts:7


assertIsValid

โ–ธ assertIsValid(monthDay): asserts monthDay is MonthDay

Parameters

NameType
monthDayunknown

Returns

asserts monthDay is MonthDay

Defined in

types/IMonthDayFns.ts:8


getDay

โ–ธ getDay(monthDay): number

Parameters

NameType
monthDayMonthDay

Returns

number

Defined in

types/IMonthDayFns.ts:9


getMonth

โ–ธ getMonth(monthDay): number

Parameters

NameType
monthDayMonthDay

Returns

number

Defined in

types/IMonthDayFns.ts:10


with

โ–ธ with(monthDay, monthDayLike, options?): MonthDay

Parameters

NameType
monthDayMonthDay
monthDayLikeObject
monthDayLike.monthnumber
monthDayLike.daynumber
options?Object
options.overflowTemporalOverflow

Returns

MonthDay

Defined in

types/IMonthDayFns.ts:11


equals

โ–ธ equals(monthDay, other): boolean

Parameters

NameType
monthDayMonthDay
otherMonthDay

Returns

boolean

Defined in

types/IMonthDayFns.ts:19


toDate

โ–ธ toDate(monthDay, year): Date

Parameters

NameType
monthDayMonthDay
yearnumber

Returns

Date

Defined in

types/IMonthDayFns.ts:20


getFields

โ–ธ getFields(monthDay): Object

Parameters

NameType
monthDayMonthDay

Returns

Object

NameType
monthnumber
daynumber

Defined in

types/IMonthDayFns.ts:21


from

โ–ธ from(item, options?): MonthDay

Parameters

NameType
itemany
options?Object
options.overflowTemporalOverflow

Returns

MonthDay

Defined in

types/IMonthDayFns.ts:25


compare

โ–ธ compare(one, two): number

Parameters

NameType
oneMonthDay
twoMonthDay

Returns

number

Defined in

types/IMonthDayFns.ts:26


format

โ–ธ format(monthDay, format): string

summary Format the ZonedDateTime.

description Return the formatted ZonedDateTime string in the given format.

The characters wrapped between two single quotes characters (') are escaped. Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. (see the last example)

Format of the string is based on Unicode Technical Standard #35: https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table with a few additions (see note 7 below the table).

Accepted patterns:

UnitPatternResult examplesNotes
QuarterQ1, 2, 3, 4
Qo1st, 2nd, 3rd, 4th3
QQ01, 02, 03, 04
QQQQ1, Q2, Q3, Q4
QQQQ1st quarter, 2nd quarter, ...1
QQQQQ1, 2, 3, 42
MonthM1, 2, ..., 12
Mo1st, 2nd, ..., 12th3
MM01, 02, ..., 12
MMMJan, Feb, ..., Dec
MMMMJanuary, February, ..., December1
MMMMMJ, F, ..., D
Day of monthd1, 2, ..., 31
do1st, 2nd, ..., 31st3
dd01, 02, ..., 31

Notes:

  1. Any sequence of the identical letters is a pattern, unless it is escaped by the single quote characters (see below). If the sequence is longer than listed in table (e.g. EEEEEEEEEEE) the output will be the same as default pattern for this unit, usually the longest one (in case of ISO weekdays, EEEE). Default patterns for units are marked with "2" in the last column of the table.

    format("2017-11-06", 'MMM') //=> 'Nov'

    format("2017-11-06", 'MMMM') //=> 'November'

    format("2017-11-06", 'MMMMM') //=> 'N'

    format("2017-11-06", 'MMMMMM') //=> 'November'

    format("2017-11-06", 'MMMMMMM') //=> 'November'

  2. QQQQQ could be not strictly numerical in some locales. These tokens represent the shortest form of the quarter.

  3. These patterns are not in the Unicode Technical Standard #35:

    • o: ordinal number modifier
  • Characters are escaped using single quote symbols (').

example

// Represent 11 February 2014 in middle-endian format:
var result = format("--02-11", 'MM/dd')
//=> '02/11'

Parameters

NameTypeDescription
monthDayMonthDaythe original date
formatstringthe string of tokens

Returns

string

the formatted date string

Defined in

types/IMonthDayFns.ts:98


chain

โ–ธ chain(monthDay): IMonthDayChain

Parameters

NameType
monthDayMonthDay

Returns

IMonthDayChain

Defined in

types/IMonthDayFns.ts:99