Skip to content

Commit

Permalink
docs: rename getYearMonth to toYearMonth
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzokuken committed Jul 1, 2020
1 parent 5e0f1fd commit cb9cbf7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions docs/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions docs/yearmonth.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb9cbf7

Please sign in to comment.