Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add testing around datepicker selected date display

TzeYiingbc5d3c9b6b29
diff --git a/studio/tests/pages/projects/Logs.Datepickers.test.js b/studio/tests/pages/projects/Logs.Datepickers.test.js
index 70807290ca3..8edce3b3924 100644
--- a/studio/tests/pages/projects/Logs.Datepickers.test.js
+++ b/studio/tests/pages/projects/Logs.Datepickers.test.js
@@ -4,7 +4,8 @@ import { PREVIEWER_DATEPICKER_HELPERS } from 'components/interfaces/Settings/Log
import DatePickers from 'components/interfaces/Settings/Logs/Logs.DatePickers'
import dayjs from 'dayjs'
import { render } from '../../helpers'
-
+import timezone from 'dayjs/plugin/timezone'
+dayjs.extend(timezone)
test('renders warning', async () => {
const from = dayjs().subtract(60, 'days')
const to = dayjs()
@@ -19,3 +20,19 @@ test('renders warning', async () => {
await screen.findByText(/memory errors/)
await screen.findByText(RegExp(from.format('MMMM YYYY')))
})
+
+test('renders dates in local time', async () => {
+ const from = dayjs().subtract(1, 'days')
+ const to = dayjs()
+ const tz = 'Asia/Taipei'
+ render(
+ <DatePickers
+ helpers={PREVIEWER_DATEPICKER_HELPERS}
+ to={to.toISOString()}
+ from={from.toISOString()}
+ />
+ )
+ // renders time locally
+ userEvent.click(await screen.findByText(RegExp(from.tz(tz).format('DD MMM'))))
+ await screen.findByText(RegExp(from.tz(tz).format('MMMM YYYY')))
+})