Install our app for a better experience!

Timezone-Aware Exports

Timezone-Aware Exports

Overview

The system provides basic timezone support for exports, automatically detecting the user's browser timezone and converting timestamps accordingly. This ensures that exported data displays times in a format familiar to the user.

How Timezone Detection Works

Automatic Browser Detection

The system uses JavaScript to detect the user's timezone:

const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
// Examples: "America/New_York", "Europe/London", "Asia/Tokyo"

Supported Timezone Formats

The system supports IANA timezone identifiers including:

Region Example Timezones
Americas America/New_York, America/Los_Angeles, America/Chicago
Europe Europe/London, Europe/Paris, Europe/Berlin
Asia Asia/Tokyo, Asia/Shanghai, Asia/Kolkata
Australia Australia/Sydney, Australia/Melbourne

Export Formats with Timezone Support

CSV Exports

Timestamps in CSV files are converted to the user's detected timezone:

Evaluation Date, Teacher Name, Score
2024-01-15 14:30:25 EST, John Smith, 85.5
2024-01-15 19:30:25 GMT, Jane Doe, 92.0

How It Works

  1. Detection: Browser timezone detected via JavaScript
  2. Transmission: Timezone sent to server with export request
  3. Conversion: Server converts UTC timestamps to user timezone
  4. Display: Exported file shows times in user's local timezone

Supported Export Types

Assessment Exports

  • Teacher evaluation reports
  • Rubric performance data
  • Batch evaluation summaries
  • Organization analytics

Student Exports

  • Exam results and performance
  • Study plan progress
  • Assignment submissions
  • Analytics reports

Technical Details

Server-Side Processing

The timezone conversion happens on the server using Python's timezone utilities:

# Basic timezone conversion (from actual codebase)
from qbank.utils.timezone_utils import convert_to_local_time

local_time = convert_to_local_time(utc_timestamp, user_timezone)

Export Request Flow

  1. User clicks export button
  2. JavaScript detects browser timezone
  3. Timezone sent as parameter: ?timezone=America/New_York
  4. Server processes export with timezone conversion
  5. File downloaded with localized timestamps

Limitations

Current System Constraints

  • No User Preferences: Timezone is detected per-session, not saved
  • No Organization Defaults: No organization-level timezone settings
  • Basic Conversion: Simple UTC-to-local conversion only
  • Limited Customization: No format preference options

Browser Dependency

  • Requires JavaScript enabled
  • Depends on browser timezone settings
  • May not work with privacy tools that block timezone detection

Troubleshooting

Common Issues

Timezone shows as UTC instead of local time - Check if JavaScript is enabled in browser - Verify browser timezone settings are correct - Try refreshing the page to re-detect timezone

Export times don't match expected timezone - Verify browser's system timezone is set correctly - Check if using VPN that affects timezone detection - Try exporting from different browser or device

Inconsistent time display - Browser timezone settings may have changed - Daylight saving time transitions can cause confusion - Clear browser cache and retry export

Error Messages

"Timezone detection failed" - JavaScript may be disabled - Browser may not support timezone detection - Export will default to UTC time

"Invalid timezone parameter" - Browser sent unsupported timezone identifier - Export will fall back to UTC time - Contact administrator if problem persists

Best Practices

For Users

  1. Verify Timezone: Check browser timezone settings before exporting
  2. Consistent Environment: Use same computer/browser for related exports
  3. Document Timezone: Note which timezone was used for important exports
  4. Cross-Reference: Compare with other sources if times seem incorrect

For Administrators

  1. User Training: Educate users about timezone handling
  2. Documentation: Include timezone information in export file names
  3. Support: Help users troubleshoot timezone-related issues
  4. Monitoring: Track timezone-related support requests