From cb9cbf792c62ad880d63d4762cb6b171d100f648 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Thu, 2 Jul 2020 00:11:29 +0530 Subject: [PATCH] docs: rename getYearMonth to toYearMonth --- docs/date.md | 6 +++--- docs/datetime.md | 4 ++-- docs/yearmonth.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/date.md b/docs/date.md index 0fde74262b..bc13c9f3cc 100644 --- a/docs/date.md +++ b/docs/date.md @@ -520,7 +520,7 @@ time = Temporal.Time.from('15:23:30.003'); date.toDateTime(time) // => 2006-08-24T15:23:30.003 ``` -### date.**getYearMonth**() : Temporal.YearMonth +### date.**toYearMonth**() : Temporal.YearMonth **Returns:** a `Temporal.YearMonth` object that is the same as the year and month of `date`. @@ -529,12 +529,12 @@ date.toDateTime(time) // => 2006-08-24T15:23:30.003 **Returns:** a `Temporal.MonthDay` object that is the same as the month and day of `date`. The above two methods can be used to convert `Temporal.Date` into a `Temporal.YearMonth` or `Temporal.MonthDay` respectively. -The converted object carries a copy of all the relevant fields of `date` (for example, in `getYearMonth()`, the `year` and `month` properties are copied.) +The converted object carries a copy of all the relevant fields of `date` (for example, in `toYearMonth()`, the `year` and `month` properties are copied.) Usage example: ```javascript date = Temporal.Date.from('2006-08-24'); -date.getYearMonth() // => 2006-08 +date.toYearMonth() // => 2006-08 date.toMonthDay() // => 08-24 ``` diff --git a/docs/datetime.md b/docs/datetime.md index e2a694bec2..f6117911a7 100644 --- a/docs/datetime.md +++ b/docs/datetime.md @@ -595,7 +595,7 @@ If the result is earlier or later than the range that `Temporal.Absolute` can re **Returns:** a `Temporal.Date` object that is the same as the date portion of `datetime`. -### datetime.**getYearMonth**() : Temporal.YearMonth +### datetime.**toYearMonth**() : Temporal.YearMonth **Returns:** a `Temporal.YearMonth` object that is the same as the year and month of `datetime`. @@ -614,7 +614,7 @@ Usage example: ```javascript dt = new Temporal.DateTime(1995, 12, 7, 3, 24, 30, 0, 3, 500); dt.toDate() // => 1995-12-07 -dt.getYearMonth() // => 1995-12 +dt.toYearMonth() // => 1995-12 dt.toMonthDay() // => 12-07 dt.toTime() // => 03:24:30.000003500 ``` diff --git a/docs/yearmonth.md b/docs/yearmonth.md index 5df95e6c67..5e1eefdc22 100644 --- a/docs/yearmonth.md +++ b/docs/yearmonth.md @@ -30,7 +30,7 @@ Otherwise, `Temporal.YearMonth.from()`, which accepts more kinds of input, allow All values are given as reckoned in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates). Together, `isoYear`, `isoMonth`, and `refISODay` must represent a valid date in that calendar, even if you are passing a different calendar as the `calendar` parameter. -The range of allowed values for this type is exactly enough that calling [`getYearMonth()`](./date.html#getYearMonth) on any valid `Temporal.Date` will succeed. +The range of allowed values for this type is exactly enough that calling [`toYearMonth()`](./date.html#toYearMonth) on any valid `Temporal.Date` will succeed. If `isoYear` and `isoMonth` are outside of this range, then this function will throw a `RangeError`. > **NOTE**: The `isoMonth` argument ranges from 1 to 12, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -220,7 +220,7 @@ If the result is earlier or later than the range of dates that `Temporal.YearMon > **NOTE**: Unlike in `Temporal.Date.prototype.with()`, a `calendar` property is not allowed on `yearMonthLike`. > It is not possible to convert a `Temporal.YearMonth` to another calendar system without knowing the day of the month. -> If you need to do this, use `yearMonth.toDate(day).withCalendar(calendar).getYearMonth()`. +> If you need to do this, use `yearMonth.toDate(day).withCalendar(calendar).toYearMonth()`. Usage example: ```javascript