Skip to content

Fix/safari date parsing issue 642#660

Open
Daksh7785 wants to merge 22 commits into
ritesh-1918:gssocfrom
Daksh7785:fix/safari-date-parsing-issue-642
Open

Fix/safari date parsing issue 642#660
Daksh7785 wants to merge 22 commits into
ritesh-1918:gssocfrom
Daksh7785:fix/safari-date-parsing-issue-642

Conversation

@Daksh7785
Copy link
Copy Markdown

🎯 Problem Statement

Currently, Safari browsers (especially older versions) fail to parse certain standardized ISO-8601 timestamps returned from Supabase, leading to invalid date text (NaN) or blanks on the Ticket Timeline.

We need to normalize date formats before parsing them client-side. Specifically:

  • Space-separated datetimes (e.g., "2024-03-10 08:00:00") fail in older WebKit engines.
  • Date strings containing milliseconds or microseconds with no explicit timezone indicator (e.g., "2024-03-10T08:00:00.123") throw errors.
  • Falsy (null, undefined) or corrupt dates trigger page exceptions instead of defaulting gracefully.

🛠️ Required Technical Implementation Steps & Fixes

1. Robust Date Normalizer (safeParseDateStr)

Refactored date helpers in Frontend/src/utils/dateUtils.js to introduce a robust date parser pipeline:

  • Format Standardization: Replaces space separators with T (Safari requirement).
  • Timezone Safety: Automatically appends Z when no timezone offset (Z, +, -) exists to safely interpret it as UTC.
  • Precision Fallback: Strips sub-second milliseconds/microseconds if the browser's native parser fails.
  • Graceful Fallbacks: If the input is empty, null, undefined, or corrupt, it defaults to the current local timestamp (new Date()) instead of breaking the UI.

All 9 consumer files (TicketTimeline, RecentTickets, MyTickets, etc.) remain completely untouched as all public API signatures (formatTimelineDate, getTimeZoneAbbr, formatFullTimestamp) are backward-compatible.

2. Testing Framework Configuration

  • Configured Vitest inside vite.config.js to run in a lightweight jsdom environment.
  • Added standard test, test:watch, and test:ui commands to package.json.

🧪 Unit Tests & Verification

Created Frontend/src/utils/dateUtils.test.js covering 24 unique test assertions validating:

  • Supabase UTC strings (no Z)
  • Millisecond & 6-digit microsecond inputs
  • Space-separated dates
  • Existing timezone offset styles (Z, +05:30, -08:00)
  • Graceful fallback states for empty, null, undefined, or corrupt strings
  • Fallback support for missing browser Intl API

🚀 Test Output Status

All 24 test assertions passed successfully:

 RUN  v2.1.9 C:/Users/ASUS/Desktop/666/HELPDESK.AI/Frontend

 ✓ src/utils/dateUtils.test.js (24 tests) 94ms

 Test Files  1 passed (1)
      Tests  24 passed (24)
   Start at  01:18:47
   Duration  2.24s

ritesh-1918 and others added 22 commits May 23, 2026 15:46
…h optimized for mobile viewport, supporting dynamic role redirection, accept/divert claiming, RAG overrides, CSAT stars, user clearance directories, and real-time settings sync
…epair profile logout, rename neural processing to AI triage
…s table, fix FlatList perf warning in AdminTicketDetailScreen
feat(monitoring): Set up Prometheus metrics and Grafana Dashboard for AI Inference Latency
feat(security): Implement transparent AES-256 GCM PII encryption for database tickets
feat(security): Implement AI-powered Spam and Phishing Detection for tickets and OCR
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@Daksh7785 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1564d672-9000-4331-871b-715d3e56221b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants