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
fromNumbers
โธ fromNumbers(month
, day
): MonthDay
Parameters
Name | Type |
---|---|
month | number |
day | number |
Returns
Defined in
isValid
โธ isValid(monthDay
): monthDay is MonthDay
Parameters
Name | Type |
---|---|
monthDay | unknown |
Returns
monthDay is MonthDay
Defined in
assertIsValid
โธ assertIsValid(monthDay
): asserts monthDay is MonthDay
Parameters
Name | Type |
---|---|
monthDay | unknown |
Returns
asserts monthDay is MonthDay
Defined in
getDay
โธ getDay(monthDay
): number
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
Returns
number
Defined in
getMonth
โธ getMonth(monthDay
): number
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
Returns
number
Defined in
with
โธ with(monthDay
, monthDayLike
, options?
): MonthDay
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
monthDayLike | Object |
monthDayLike.month | number |
monthDayLike.day | number |
options? | Object |
options.overflow | TemporalOverflow |
Returns
Defined in
equals
โธ equals(monthDay
, other
): boolean
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
other | MonthDay |
Returns
boolean
Defined in
toDate
โธ toDate(monthDay
, year
): Date
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
year | number |
Returns
Defined in
getFields
โธ getFields(monthDay
): Object
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
Returns
Object
Name | Type |
---|---|
month | number |
day | number |
Defined in
from
โธ from(item
, options?
): MonthDay
Parameters
Name | Type |
---|---|
item | any |
options? | Object |
options.overflow | TemporalOverflow |
Returns
Defined in
compare
โธ compare(one
, two
): number
Parameters
Name | Type |
---|---|
one | MonthDay |
two | MonthDay |
Returns
number
Defined in
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:
Unit | Pattern | Result examples | Notes |
---|---|---|---|
Quarter | Q | 1, 2, 3, 4 | |
Qo | 1st, 2nd, 3rd, 4th | 3 | |
01, 02, 03, 04 | |||
QQQ | Q1, Q2, Q3, Q4 | ||
QQQQ | 1st quarter, 2nd quarter, ... | 1 | |
QQQQQ | 1, 2, 3, 4 | 2 | |
Month | M | 1, 2, ..., 12 | |
Mo | 1st, 2nd, ..., 12th | 3 | |
MM | 01, 02, ..., 12 | ||
MMM | Jan, Feb, ..., Dec | ||
MMMM | January, February, ..., December | 1 | |
MMMMM | J, F, ..., D | ||
Day of month | d | 1, 2, ..., 31 | |
do | 1st, 2nd, ..., 31st | 3 | |
dd | 01, 02, ..., 31 |
Notes:
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'
QQQQQ
could be not strictly numerical in some locales. These tokens represent the shortest form of the quarter.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
Name | Type | Description |
---|---|---|
monthDay | MonthDay | the original date |
format | string | the string of tokens |
Returns
string
the formatted date string
Defined in
chain
โธ chain(monthDay
): IMonthDayChain
Parameters
Name | Type |
---|---|
monthDay | MonthDay |
Returns
IMonthDayChain