Timezone Resolution#
Perses supports multiple levels of timezone configuration to provide flexibility in how timestamps are displayed across dashboards and panels.
Overview#
Timezone configuration in Perses determines how date and time values are formatted and displayed throughout the application. The system uses a resolution hierarchy to determine which timezone to apply when formatting timestamps.
Note
This documentation describes the current timezone behavior and the planned multi-level configuration system. As Perses evolves to support multiple configuration levels, this document will be updated to reflect the implementation details.
Current Implementation#
As of the current version, Perses implements timezone handling primarily through the date formatting system in the UI layer.
Date Format Units#
Perses provides several date format units, each with specific timezone behavior:
Fixed Timezone Formats#
These formats always use a specific timezone regardless of user settings:
datetime-iso: Always displays in GMT/UTC (ISO 8601 format)datetime-us: Always displays in US Eastern timezone (America/New_York)date-iso: Always displays date in GMT/UTCdate-us: Always displays date in US Eastern timezonetime-iso: Always displays time in GMT/UTCtime-us: Always displays time in US Eastern timezone
Browser-Local Formats#
These formats use the browser's detected local timezone:
datetime-local: Displays date and time in browser's local timezone (24-hour format)date-local: Displays date in browser's local timezonetime-local: Displays time in browser's local timezone (24-hour format)
Other Formats#
relative-time: Displays relative time (e.g., "5 minutes ago", "2 hours ago")unix-timestamp: Displays raw Unix timestamp in secondsunix-timestamp-ms: Displays raw Unix timestamp in milliseconds
Timezone Resolution Logic#
Current Behavior#
The timezone resolution follows this logic when formatting dates:
- Format-Specific Override: If the date format unit has a hardcoded timezone (e.g.,
datetime-us,time-iso), that timezone is always used. - Explicit
timeZoneParameter: If atimeZoneparameter is provided in the format options, it is used for formats that support it. - Browser Default: For local formats or when no timezone is specified, the browser's detected timezone is used.
Format Options#
When formatting dates, the following options are available:
unit: The date format unit to use (default:datetime-local)locale: The locale for formatting (default: browser's locale)timeZone: The timezone to use for formatting (default: browser's timezone)referenceTime: Reference time for relative formatting (default: current time)
Future Enhancements#
Perses plans to support a multi-level timezone configuration system. The following levels are expected (in order of precedence, highest to lowest):
- Panel-Level: Timezone specified directly on a panel
- Dashboard-Level: Timezone specified for an entire dashboard
- User Preference: User's personal timezone preference set in their profile
- Project-Level: Default timezone for a project
- Global Configuration: System-wide default configured on the Perses server
- Browser Default: Fallback to the browser's detected timezone
Note
These configuration levels are still being developed. This document will be updated as the feature evolves.
Best Practices#
- Use ISO formats for UTC times: When displaying absolute timestamps that should be consistent across all users, use
datetime-isoortime-iso. - Use local formats for user-centric times: When displaying times relative to the user's location, use
datetime-localortime-local. - Use US formats for US-specific data: When displaying data tied to US Eastern time (e.g., US market hours), use
datetime-usortime-us. - Consider relative time for recent events: For timestamps within the last few hours or days,
relative-timeprovides a better user experience. - Document timezone assumptions: When creating dashboards, document which timezone is being used for data interpretation.
Troubleshooting#
Common Issues#
Issue: Timestamps are displayed in an unexpected timezone
Solution: Check the timezone resolution hierarchy:
- Verify if the panel has a timezone configured
- Check the dashboard timezone setting
- Review your user timezone preference
- Check the project default timezone
- Verify the global server configuration
- Confirm your browser's timezone detection
Issue: Date format unit doesn't respect timezone setting
Solution: Some date format units have fixed timezones:
datetime-iso,date-iso,time-isoalways use UTCdatetime-us,date-us,time-usalways use US Eastern time- Use
datetime-local,date-local, ortime-localfor timezone-aware formatting