cc-time-zone-safety

Detects and fixes timezone drift bugs in server-side date and time handling.

1.0k|109|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/doccker/cc-use-exp --skill cc-time-zone-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cc-time-zone-safety
Source: https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-time-zone-safety
Command: npx skills add https://github.com/doccker/cc-use-exp --skill cc-time-zone-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Server code that calls bare LocalDate.now(), new Date(), or time.Now() silently depends on the JVM or container default timezone, so the same code produces different "today" or "week start" values in development (Asia/Shanghai) versus production (UTC), causing statistics and reports to shift by 8 hours.

Core Features & Use Cases

  • Bare now() Detection: Provides grep-based sniffing commands to find unqualified LocalDate.now(), new Date(), time.Now(), and Date.now() calls across Java, Go, Python, and TypeScript codebases.
  • Boundary Calculation Rules: Defines correct patterns for computing week, month, and day start points with an explicit business timezone constant like BIZ_ZONE.
  • Database & Deployment Alignment: Covers JDBC serverTimezone configuration, MySQL DATETIME vs TIMESTAMP strategy selection, and Docker TZ pinning to keep application, database, and infrastructure layers consistent.
  • Use Case: A daily order report misses rows after deployment to a UTC-based Docker host. Use this Skill to audit the codebase for bare .now() calls, fix the week-start calculation with an explicit zone, and align the JDBC connection string.

Quick Start

Ask the AI to review my service-layer code for timezone safety issues and fix any bare now() calls using a unified business timezone constant.

Frequently Asked Questions about cc-time-zone-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix LocalDate.now() timezone bugs in Java?

Pass an explicit ZoneId such as a project-wide BIZ_ZONE constant to every LocalDate.now() and LocalDateTime.now() call. This removes dependence on the JVM default timezone, which often differs between development machines and UTC-based Docker containers.

Why does my daily report miss data after deploying to production?

The production container likely defaults to UTC while the database stores business-timezone values, so a day boundary computed with the default zone shifts by 8 hours. Compute day start with an explicit zone and align the JDBC serverTimezone setting.

Should I use DATETIME or TIMESTAMP in MySQL for timezone safety?

Use DATETIME with serverTimezone set to the business zone for single-region applications, or TIMESTAMP with UTC storage and Instant fields for cross-region systems. Mixing DATETIME columns with a UTC connection string causes the hardest conversion bugs to diagnose.

How do I handle timezones in Go and Python backend code?

In Go, convert time.Now() with In() using a loaded Asia/Shanghai location instead of relying on the system zone. In Python, use datetime.now(tz=ZoneInfo("Asia/Shanghai")) to get aware datetimes rather than naive ones.

When is it safe to call Instant.now() without a timezone?

Instant.now() is always safe because it represents an absolute UTC timestamp with no zone ambiguity. Use Instant for cross-timezone comparisons and storage, and reserve zoned types like LocalDateTime for business-calendar boundary calculations.