Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demo/yun/components/test/TestFormatDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const formattedDate = computed(() => {
return formatDate(props.date, {
template: props.template,
timezone: props.timezone,
keepLocalTime: props.keepLocalTime,
})
})
</script>
Expand Down
2 changes: 2 additions & 0 deletions e2e/theme-yun/time.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ test.use({
})

test.beforeEach(async ({ page }) => {
process.env.TZ = 'Asia/Shanghai'

await page.goto('/posts/date')
})

Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/client/composables/global.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'
import { useSiteConfig } from 'valaxy'
import { onBeforeMount } from 'vue'
import { dayjs } from '../utils/time'

/**
* use timezone
Expand Down
4 changes: 4 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default defineConfig({
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
locale: 'zh-CN',
// set timezone for test
timezoneId: 'Asia/Shanghai',

/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

Expand Down
2 changes: 1 addition & 1 deletion test/date.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ it('dayjs date', () => {
})

describe('dayjs date', () => {
// process.env.TZ = 'Asia/Shanghai'
process.env.TZ = 'Asia/Shanghai'
dayjs.tz.setDefault('Asia/Shanghai')

for (let i = 0; i < dateExamples.length; i++) {
Expand Down
Loading