Skip to content

Timezone Selector Bug: Cannot Set Timezones with Underscores via Web UI #257

Description

@CaullenOmdahl

Summary

The ZimaOS web UI timezone selector truncates timezone names containing underscores, making it impossible to set timezones like Asia/Ho_Chi_Minh, Asia/Hong_Kong, America/New_York, etc. The UI converts underscores to spaces and truncates at the first space, sending invalid timezone identifiers to the backend.

Environment

  • ZimaOS Version: v1.4.2
  • Hardware: ZimaCube
  • Build Date: 2025/08/01 13:41:23 UTC
  • Kernel: Linux ZimaOS 6.12.25

Bug Description

When selecting a timezone with underscores (e.g., "Ho Chi Minh") from the web UI timezone selector, the frontend incorrectly processes the timezone name:

  1. Converts underscores to spaces: Asia/Ho_Chi_MinhAsia/Ho Chi Minh
  2. Truncates at first space: Asia/Ho Chi MinhAsia/Ho
  3. Sends invalid timezone to backend: Asia/Ho
  4. Backend correctly rejects invalid timezone
  5. User sees truncated name but timezone never actually changes

Steps to Reproduce

  1. Access ZimaOS web interface
  2. Navigate to timezone settings
  3. Select "Ho Chi Minh" from timezone dropdown
  4. Observe that UI shows "Asia/Ho" instead of "Asia/Ho_Chi_Minh"
  5. Check system timezone via SSH: timedatectl status
  6. Notice timezone hasn't actually changed

Expected vs Actual Behavior

Expected:

  • UI should display full timezone name "Asia/Ho_Chi_Minh"
  • Backend should receive valid timezone identifier
  • System timezone should change successfully

Actual:

  • UI displays truncated name "Asia/Ho"
  • Backend receives invalid identifier "Asia/Ho"
  • System timezone remains unchanged
  • No error feedback to user

Evidence from System Logs

Aug 07 05:53:01 ZimaOS zimaos-user[1767]: error failed to set timezone {"timezone": "Asia/Ho", "error": "exit status 1"}
Aug 07 05:53:26 ZimaOS zimaos-user[1767]: error failed to set timezone {"timezone": "Asia/Ho", "error": "exit status 1"}

Affected Timezones

All timezone identifiers containing underscores, including but not limited to:

  • Asia/Ho_Chi_MinhAsia/Ho
  • Asia/Hong_KongAsia/Hong
  • Asia/Kuala_LumpurAsia/Kuala
  • Asia/Tel_AvivAsia/Tel
  • America/New_YorkAmerica/New
  • America/Los_AngelesAmerica/Los
  • Pacific/Port_MoresbyPacific/Port

Workaround

Use SSH to set timezone via command line:

sudo timedatectl set-timezone Asia/Ho_Chi_Minh

Technical Details

  • Affected Components: Frontend timezone selector UI component
  • Backend Services:
    • /home/runner/work/ZimaOS-UserService/ZimaOS-UserService/service/user.go:142
    • /home/runner/work/ZimaOS-UserService/ZimaOS-UserService/route/v1/user.go:615
  • Root Cause: String processing logic in frontend that replaces _ with and truncates at first space

Suggested Fix

  1. Frontend: Remove underscore-to-space replacement logic in timezone selector
  2. Alternative: If display formatting is needed, keep original identifier for backend communication while showing formatted version to user
  3. Validation: Add frontend validation to ensure timezone identifiers exist before sending to backend
  4. Error Handling: Display error messages when timezone setting fails

Impact

  • Severity: Medium-High (affects major cities/timezones)
  • User Experience: Confusing and frustrating - users can't set their correct timezone
  • Geographic Impact: Affects users in Vietnam, Hong Kong, Malaysia, Israel, USA, and many other regions
  • Workaround Available: Yes (CLI), but requires technical knowledge

Additional Context

  • Backend timezone service works correctly and properly validates timezone identifiers
  • Issue is purely in frontend timezone selection component
  • System time calculations work correctly once proper timezone is set via CLI
  • Bug affects web UI only - CLI timezone setting works perfectly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions