From 9919e8b2cfbc971defe8870c8f5ecc0dd340e2f7 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Wed, 12 Jan 2022 21:19:33 +0800 Subject: [PATCH] fix(Calendar): fix timezone (#4742) * fix(Calendar): fix timezone * test(Calendar): update demo snap --- .github/workflows/test.yml | 5 +++++ packages/calendar/index.wxs | 1 - packages/calendar/test/__snapshots__/demo.spec.ts.snap | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09842dc2..585158aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,11 @@ jobs: test: runs-on: ubuntu-latest steps: + - uses: szenius/set-timezone@v1.0 + with: + timezoneLinux: "Asia/Shanghai" + timezoneMacos: "Asia/Shanghai" + timezoneWindows: "China Standard Time" - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: diff --git a/packages/calendar/index.wxs b/packages/calendar/index.wxs index 0c570fc6..2c04be10 100644 --- a/packages/calendar/index.wxs +++ b/packages/calendar/index.wxs @@ -6,7 +6,6 @@ function getMonths(minDate, maxDate) { var cursor = getDate(minDate); cursor.setDate(1); - cursor.setMinutes(cursor.getMinutes() - cursor.getTimezoneOffset()); do { months.push(cursor.getTime()); diff --git a/packages/calendar/test/__snapshots__/demo.spec.ts.snap b/packages/calendar/test/__snapshots__/demo.spec.ts.snap index b2e135cc..583bc080 100644 --- a/packages/calendar/test/__snapshots__/demo.spec.ts.snap +++ b/packages/calendar/test/__snapshots__/demo.spec.ts.snap @@ -497,7 +497,7 @@ exports[`should render demo and match snapshot 1`] = ` > @@ -892,7 +892,7 @@ exports[`should render demo and match snapshot 1`] = ` @@ -1270,7 +1270,7 @@ exports[`should render demo and match snapshot 1`] = `