fix: timezone fix on mail, changed utc to asia/kolkata - #69
Conversation
📝 WalkthroughWalkthroughThe pull request updates date and time formatting across multiple components and services to consistently use the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Updates date/time formatting across event views and email templates to consistently render in Asia/Kolkata (instead of falling back to server/SSR UTC), aligning UI and outbound communications with the intended local timezone.
Changes:
- Added
timeZone: 'Asia/Kolkata'to multipletoLocaleDateString/toLocaleTimeString/Intl.DateTimeFormatusages. - Fixed
EventsPageViewdate parsing to avoid mixinggetDate()/getFullYear()(server-local) with locale formatting by deriving day/year via locale formatting in the target timezone. - Switched
themeConfig.defaultTimezonefromUTCtoAsia/Kolkata.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/events/EventsPageView.js | Formats event date/time using Asia/Kolkata to prevent SSR UTC shifts; adjusts date parsing to be timezone-consistent. |
| src/views/events/EventDetailView.js | Ensures event detail date/time display is formatted in Asia/Kolkata. |
| src/services/email-service.js | Ensures email date/time strings render in Asia/Kolkata (prevents UTC times in emails). |
| src/configs/themeConfig.js | Updates configured default timezone to Asia/Kolkata. |
| src/components/mui/EventCard/index.js | Ensures card-level event datetime display is formatted in Asia/Kolkata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const weekday = d.toLocaleDateString('en-US', { weekday: 'long', timeZone: 'Asia/Kolkata' }) | ||
| const month = d.toLocaleDateString('en-US', { month: 'long', timeZone: 'Asia/Kolkata' }) | ||
| const day = d.toLocaleDateString('en-US', { day: 'numeric', timeZone: 'Asia/Kolkata' }) | ||
| const year = d.toLocaleDateString('en-US', { year: 'numeric', timeZone: 'Asia/Kolkata' }) | ||
| return { full: `${weekday}, ${month} ${day}, ${year}` } |
There was a problem hiding this comment.
parseEventDate builds the final string by calling toLocaleDateString four separate times. This is harder to maintain and does extra work; it can be replaced with a single toLocaleDateString (or Intl.DateTimeFormat) call that includes weekday/month/day/year and timeZone: 'Asia/Kolkata' to produce the same output deterministically.
| const weekday = d.toLocaleDateString('en-US', { weekday: 'long', timeZone: 'Asia/Kolkata' }) | |
| const month = d.toLocaleDateString('en-US', { month: 'long', timeZone: 'Asia/Kolkata' }) | |
| const day = d.toLocaleDateString('en-US', { day: 'numeric', timeZone: 'Asia/Kolkata' }) | |
| const year = d.toLocaleDateString('en-US', { year: 'numeric', timeZone: 'Asia/Kolkata' }) | |
| return { full: `${weekday}, ${month} ${day}, ${year}` } | |
| const full = d.toLocaleDateString('en-US', { | |
| weekday: 'long', | |
| month: 'long', | |
| day: 'numeric', | |
| year: 'numeric', | |
| timeZone: 'Asia/Kolkata' | |
| }) | |
| return { full } |
| // ** Event Platform | ||
| maxFileUploadMB: 10, | ||
| defaultTimezone: 'UTC', | ||
| defaultTimezone: 'Asia/Kolkata', |
There was a problem hiding this comment.
defaultTimezone is only defined here; a repo-wide search shows no other references. Consider either wiring date/time formatting to read from this config (to avoid hardcoding 'Asia/Kolkata' in multiple places) or removing it to prevent an unused setting from becoming misleading over time.
| defaultTimezone: 'Asia/Kolkata', |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/views/events/EventDetailView.js (1)
68-68: Pre-existing issue: Festival countdown date lacks timezone specification.The
FEST_STARTconstant at line 68 parses'2026-04-07T09:00:00'without a timezone offset. JavaScript interprets this as local time (server or browser), which may differ from Asia/Kolkata. Since this PR is standardizing on IST, consider specifying the timezone explicitly:-const FEST_START = new Date('2026-04-07T09:00:00').getTime() +const FEST_START = new Date('2026-04-07T09:00:00+05:30').getTime()This ensures the countdown is consistent regardless of where the code executes.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/views/events/EventDetailView.js` at line 68, FEST_START currently parses '2026-04-07T09:00:00' without a timezone, which yields local-time interpretation and breaks IST consistency; update the FEST_START constant in EventDetailView.js to create the timestamp with an explicit IST offset (e.g. use the ISO string with +05:30 like '2026-04-07T09:00:00+05:30' or construct via UTC utilities) so new Date(...) yields the intended Asia/Kolkata moment regardless of server/browser timezone.src/configs/themeConfig.js (1)
45-45: Config value defined but not used by formatting functions.The
defaultTimezoneis set to'Asia/Kolkata'in themeConfig.js, but the timezone formatting functions across the codebase (EventsPageView, UpcomingEventsScroller, FeaturedEvents, CartView, EventDetailView, generateTicketPDF, email-service, etc.) hardcode the timezone string directly instead of importing and usingthemeConfig.defaultTimezone.If the timezone needs to change in the future, all files must be updated individually.
Consider having the formatting helpers import and reference this config value for better maintainability.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/configs/themeConfig.js` at line 45, Update timezone handling to use the central config: import defaultTimezone from themeConfig (the exported defaultTimezone constant) into the formatting helper modules and components (e.g., where EventsPageView, UpcomingEventsScroller, FeaturedEvents, CartView, EventDetailView, generateTicketPDF, email-service format times) and replace hardcoded timezone strings with that imported defaultTimezone; ensure any helper functions that accept a timezone parameter default to themeConfig.defaultTimezone and update all calls to use the helper so changing themeConfig.defaultTimezone updates behavior everywhere.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/configs/themeConfig.js`:
- Line 45: Update timezone handling to use the central config: import
defaultTimezone from themeConfig (the exported defaultTimezone constant) into
the formatting helper modules and components (e.g., where EventsPageView,
UpcomingEventsScroller, FeaturedEvents, CartView, EventDetailView,
generateTicketPDF, email-service format times) and replace hardcoded timezone
strings with that imported defaultTimezone; ensure any helper functions that
accept a timezone parameter default to themeConfig.defaultTimezone and update
all calls to use the helper so changing themeConfig.defaultTimezone updates
behavior everywhere.
In `@src/views/events/EventDetailView.js`:
- Line 68: FEST_START currently parses '2026-04-07T09:00:00' without a timezone,
which yields local-time interpretation and breaks IST consistency; update the
FEST_START constant in EventDetailView.js to create the timestamp with an
explicit IST offset (e.g. use the ISO string with +05:30 like
'2026-04-07T09:00:00+05:30' or construct via UTC utilities) so new Date(...)
yields the intended Asia/Kolkata moment regardless of server/browser timezone.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7606ce18-8841-4bdf-af13-31da671b8290
📒 Files selected for processing (5)
src/components/mui/EventCard/index.jssrc/configs/themeConfig.jssrc/services/email-service.jssrc/views/events/EventDetailView.jssrc/views/events/EventsPageView.js
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Checklist:
Summary by CodeRabbit