From e2e51161ca1f3b6fabd43b7a04f0ffb1252611f1 Mon Sep 17 00:00:00 2001 From: iamkun Date: Wed, 4 Jul 2018 09:46:54 +0800 Subject: [PATCH 1/2] fix: DEPRECATED isLeapYear, use IsLeapYear plugin instead --- src/index.js | 4 ---- test/query.test.js | 5 ----- 2 files changed, 9 deletions(-) diff --git a/src/index.js b/src/index.js index 626be49a5..2c79674d7 100644 --- a/src/index.js +++ b/src/index.js @@ -92,10 +92,6 @@ class Dayjs { return !(this.$d.toString() === 'Invalid Date') } - isLeapYear() { - return ((this.$y % 4 === 0) && (this.$y % 100 !== 0)) || (this.$y % 400 === 0) - } - $compare(that) { return this.valueOf() - dayjs(that).valueOf() } diff --git a/test/query.test.js b/test/query.test.js index 977a68e09..09f99b7f8 100644 --- a/test/query.test.js +++ b/test/query.test.js @@ -12,11 +12,6 @@ afterEach(() => { const testArr = [dayjs, moment] -it('IsLeapYear', () => { - expect(dayjs('20000101').isLeapYear()).toBe(true) - expect(dayjs('2100-01-01').isLeapYear()).toBe(false) -}) - describe('Is Before Is After Is Same', () => { it('Compare to dayjs object', () => { testArr.forEach((instance) => { From 322b42b3fd16fc174a31c387c86b3ffa16d46d9b Mon Sep 17 00:00:00 2001 From: iamkun Date: Wed, 4 Jul 2018 09:47:57 +0800 Subject: [PATCH 2/2] docs: update docs --- docs/en/API-reference.md | 10 ---------- docs/ja/API-reference.md | 13 ------------- docs/ko/API-reference.md | 10 ---------- docs/pt-br/API-reference.md | 13 ------------- docs/zh-cn/API-reference.md | 12 ------------ 5 files changed, 58 deletions(-) diff --git a/docs/en/API-reference.md b/docs/en/API-reference.md index cd2051aa8..7c6581671 100644 --- a/docs/en/API-reference.md +++ b/docs/en/API-reference.md @@ -389,16 +389,6 @@ dayjs.isDayjs(dayjs()); // true dayjs.isDayjs(new Date()); // false ``` -### Is Leap Year `.isLeapYear()` - -**[DEPRECATED] in 1.7.0, use [`IsLeapYear plugin`](./Plugin.md#isleapyear) instead** - -Returns a `boolean` indicating whether the `Dayjs`'s year is a leap year or not. - -```js -dayjs('2000-01-01').isLeapYear(); // true -``` - ## Plugin APIs ### RelativeTime diff --git a/docs/ja/API-reference.md b/docs/ja/API-reference.md index c814cf4b8..ea142b03f 100644 --- a/docs/ja/API-reference.md +++ b/docs/ja/API-reference.md @@ -460,19 +460,6 @@ dayjs.isDayjs(dayjs()); // true dayjs.isDayjs(new Date()); // false ``` -#### Is Leap Year - -**[DEPRECATED] in 1.7.0, use [`IsLeapYear plugin`](./Plugin.md#isleapyear) instead** - -* Boolean を返します - -その年がうるう年かどうかをチェックします。 - -```js -dayjs().isLeapYear(); -dayjs('2000-01-01').isLeapYear(); // true -``` - ## Plugin APIs ### RelativeTime diff --git a/docs/ko/API-reference.md b/docs/ko/API-reference.md index 67f89dc52..feac5eabf 100644 --- a/docs/ko/API-reference.md +++ b/docs/ko/API-reference.md @@ -389,16 +389,6 @@ dayjs.isDayjs(dayjs()); // true dayjs.isDayjs(new Date()); // false ``` -### Is Leap Year `.isLeapYear()` - -**[DEPRECATED] in 1.7.0, use [`IsLeapYear plugin`](./Plugin.md#isleapyear) instead** - -`Dayjs` 값이 윤년인지를 확인합니다. 반환 타입은 `boolean` 입니다. - -```js -dayjs('2000-01-01').isLeapYear(); // true -``` - ## Plugin APIs ### RelativeTime diff --git a/docs/pt-br/API-reference.md b/docs/pt-br/API-reference.md index 3b42fc525..a2c3bec6c 100644 --- a/docs/pt-br/API-reference.md +++ b/docs/pt-br/API-reference.md @@ -438,19 +438,6 @@ dayjs.isDayjs(dayjs()); // true dayjs.isDayjs(new Date()); // false ``` -#### Ano Bissexto - -**[DEPRECATED] in 1.7.0, use [`IsLeapYear plugin`](./Plugin.md#isleapyear) instead** - -* retorna um Boolean - -Se um ano é bissexto. - -```js -dayjs().isLeapYear(); -dayjs('2000-01-01').isLeapYear(); // true -``` - ## Plugin APIs ### RelativeTime diff --git a/docs/zh-cn/API-reference.md b/docs/zh-cn/API-reference.md index 1739e0c57..00cd32484 100644 --- a/docs/zh-cn/API-reference.md +++ b/docs/zh-cn/API-reference.md @@ -338,18 +338,6 @@ dayjs.isDayjs(dayjs()); // true dayjs.isDayjs(new Date()); // false ``` -#### 是否闰年 - -**[已废弃] 将在 1.7.0 废弃, 使用 [`IsLeapYear 插件`](./Plugin.md#isleapyear) 代替** - -- return Boolean - -是否闰年。 -```js -dayjs().isLeapYear(); -dayjs('2000-01-01').isLeapYear(); // true -``` - ## 插件 APIs ### 相对时间