Skip to content

[BUG] Incorrect date display in non-UTC timezones #4514

Description

@Rokurolize

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version: 1.0.61 (Claude Code)
  • Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (Ubuntu on WSL2)
  • Terminal: bash

Bug Description

Claude Code displays incorrect dates for users in timezones ahead of UTC. When the local system date differs from UTC date, Claude reports the UTC date instead of the local date.

Steps to Reproduce

Note: This issue only occurs when local date > UTC date (early UTC hours for positive timezone offsets)

  1. Set system timezone to JST (UTC+9): sudo timedatectl set-timezone Asia/Tokyo
  2. Verify timing conditions:
    date                    # Should show JST time
    date -u                 # Should show UTC time
    # Issue occurs when JST date > UTC date (JST hours 00:00-08:59)
  3. Query Claude: echo "What is today's date?" | claude
  4. Compare result with local system date

Expected vs Actual Behavior

When local time is July 27, 2025 09:00 JST (July 27, 2025 00:00 UTC):

  • Expected: Claude reports 2025-07-27 (local date)
  • Actual: Claude reports 2025-07-27 (dates match, no issue)

When local time is July 27, 2025 06:00 JST (July 26, 2025 21:00 UTC):

  • Expected: Claude reports 2025-07-27 (local date)
  • Actual: Claude reports 2025-07-26 (UTC date)

Technical Analysis

Root Cause

Environment generation uses UTC date formatting:

Today's date: ${new Date().toISOString().split("T")[0]}  // Always UTC

Affected Conditions

  • Timezones: UTC+1 through UTC+14
  • Time Window: When local date > UTC date
  • JST Example: Daily 00:00-08:59 JST (9-hour window)
  • AEST Example: Daily 00:00-10:59 AEST (11-hour window)

Impact Assessment

  • Severity: Low (display inconsistency)
  • Frequency: Daily during specific hour windows for affected timezones
  • Workaround: Users can mentally adjust for UTC difference
  • Core Functionality: Not affected

Proposed Solution

// Replace UTC date with local timezone-aware date
Today's date: ${new Date().toLocaleDateString('en-CA')}

Benefits:

  • Uses local system timezone automatically
  • Maintains YYYY-MM-DD format consistency
  • Built-in Node.js API, no dependencies
  • Backward compatible

System Information

ubuntu@roku-pc:~$ which claude
/home/ubuntu/.bun/bin/claude
ubuntu@roku-pc:~$ claude --version
1.0.61 (Claude Code)
ubuntu@roku-pc:~$ date
2025年  7月 27日 日曜日 08:42:58 JST
ubuntu@roku-pc:~$ date -u
2025年  7月 26日 土曜日 23:43:02 UTC
ubuntu@roku-pc:~$ echo "What is today's date?" | claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /home/ubuntu                               │
│                                                   │
│   ─────────────────────────────────────────────── │
│                                                   │
│   Overrides (via env):                            │
│                                                   │
╰───────────────────────────────────────────────────╯

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 Note: You have launched claude in your home directory. For the best experience, launch it in a project directory
 instead.

 ※ Tip: Want Claude to remember something? Hit # to add preferences, tools, and instructions to Claude's memory

> What is today's date?

● 2025-07-26


ubuntu@roku-pc:~$ node -e "console.log('UTC:', new Date().toISOString().split('T')[0]); console.log('Local:', new Date().toLocaleDateString('en-CA'));"
UTC: 2025-07-26
Local: 2025-07-27
ubuntu@roku-pc:~$


Reproduction Notes

Timing-dependent: This issue only manifests when local date differs from UTC date. For JST timezone, this occurs daily from 00:00-08:59 JST. Outside this window, local and UTC dates match, and no discrepancy is visible.

Priority: Low-Medium (user experience improvement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions