Skip to content

Commit 9457c85

Browse files
authored
Merge pull request #46 from flo-l/respect-locale-weekdays
use weekday fn from days.js to respect locale weekday reordering
2 parents 9c09ff0 + 90f6eb5 commit 9457c85

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"husky": "^1.3.1",
113113
"jest": "^24.7.0",
114114
"lint-staged": "^8.1.0",
115-
"node-sass": "4.11.0",
115+
"node-sass": "4.12.0",
116116
"prettier": "^1.15.3",
117117
"prop-types": "^15.6.2",
118118
"react-docgen-typescript-loader": "^3.0.1",

src/utils/LocaleUtil.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { IDatePicker } from '../common/@types';
33
import { range } from '../utils/ArrayUtil';
44
import * as localeData from 'dayjs/plugin/localeData';
55
import * as localizedFormat from 'dayjs/plugin/localizedFormat';
6+
import * as weekday from 'dayjs/plugin/weekday';
67

78
dayjs.extend(localeData);
89
dayjs.extend(localizedFormat);
10+
dayjs.extend(weekday);
911

1012
export const getMonthShort = (locale: IDatePicker.Locale) => {
1113
dayjs.locale(locale);
@@ -21,7 +23,7 @@ export const getWeekDays = (locale: IDatePicker.Locale) => {
2123
return range(7).map(v =>
2224
dayjs()
2325
.localeData()
24-
.weekdaysShort(dayjs().day(v))
26+
.weekdaysShort(dayjs().weekday(v))
2527
);
2628
};
2729

yarn.lock

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7345,14 +7345,6 @@ lodash-es@^4.17.11:
73457345
version "4.17.15"
73467346
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
73477347

7348-
lodash.assign@^4.2.0:
7349-
version "4.2.0"
7350-
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
7351-
7352-
lodash.clonedeep@^4.3.2:
7353-
version "4.5.0"
7354-
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
7355-
73567348
lodash.debounce@^4.0.8:
73577349
version "4.0.8"
73587350
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
@@ -7377,7 +7369,7 @@ lodash.isplainobject@^4.0.6:
73777369
version "4.0.6"
73787370
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
73797371

7380-
lodash.mergewith@^4.6.0, lodash.mergewith@^4.6.1:
7372+
lodash.mergewith@^4.6.1:
73817373
version "4.6.1"
73827374
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
73837375

@@ -7860,7 +7852,12 @@ mute-stream@0.0.7:
78607852
version "0.0.7"
78617853
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
78627854

7863-
nan@^2.10.0, nan@^2.9.2:
7855+
nan@^2.13.2:
7856+
version "2.14.0"
7857+
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
7858+
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
7859+
7860+
nan@^2.9.2:
78647861
version "2.11.1"
78657862
resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766"
78667863

@@ -8052,9 +8049,10 @@ node-releases@^1.1.3:
80528049
dependencies:
80538050
semver "^5.3.0"
80548051

8055-
node-sass@4.11.0:
8056-
version "4.11.0"
8057-
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a"
8052+
node-sass@4.12.0:
8053+
version "4.12.0"
8054+
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017"
8055+
integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==
80588056
dependencies:
80598057
async-foreach "^0.1.3"
80608058
chalk "^1.1.1"
@@ -8063,12 +8061,10 @@ node-sass@4.11.0:
80638061
get-stdin "^4.0.1"
80648062
glob "^7.0.3"
80658063
in-publish "^2.0.0"
8066-
lodash.assign "^4.2.0"
8067-
lodash.clonedeep "^4.3.2"
8068-
lodash.mergewith "^4.6.0"
8064+
lodash "^4.17.11"
80698065
meow "^3.7.0"
80708066
mkdirp "^0.5.1"
8071-
nan "^2.10.0"
8067+
nan "^2.13.2"
80728068
node-gyp "^3.8.0"
80738069
npmlog "^4.0.0"
80748070
request "^2.88.0"

0 commit comments

Comments
 (0)