Skip to content

feat(timezone): make timestamps timezone-configurable#129

Merged
Maxwell-Code07 merged 1 commit into
TencentCloud:mainfrom
Xuruida:feat/timezone-configurable
Jun 4, 2026
Merged

feat(timezone): make timestamps timezone-configurable#129
Maxwell-Code07 merged 1 commit into
TencentCloud:mainfrom
Xuruida:feat/timezone-configurable

Conversation

@Xuruida
Copy link
Copy Markdown
Collaborator

@Xuruida Xuruida commented Jun 2, 2026

Description | 描述

Add a top-level timezone config option (default: "system") that controls all user/LLM-facing timestamp formatting.

  • Supports IANA timezone names (Asia/Shanghai, Europe/Berlin) and UTC offset strings (+08:00, -05:30) per ECMA-402 2024.
  • Introduces unified src/utils/time.ts module, converging 4 scattered time helpers.
  • L1 extraction / auto-recall / scene-extraction / persona-generation prompts now emit ISO 8601 with explicit UTC offset, fixing the timezone ambiguity bug where LLMs misinterpret relative time ("yesterday", "last week").
  • Adds timezone declaration to LLM system prompts.
  • Local-day shard boundaries and cleaner cutoff follow configured timezone.
  • Storage instants (SQLite/TCVDB) remain UTC — no data migration needed.
  • 38 unit tests covering IANA, offset, DST, half-hour zones, and invalid input fallback.
  • Default "system" = zero-config upgrade, fully backward-compatible.

Related Issue | 关联 Issue

Closes #75
Closes #87
Supersedes #76

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Additional Notes | 其他说明

cc @southpy @Elvisvon @YOMXXX @Maxwell-Code07

This PR builds on the direction explored in #76 by @YOMXXX — we adopted the same link-path coverage (capture/L1/L2/recall) but switched from integer timezoneOffsetMinutes to IANA timezone names for DST correctness. Thank you for the groundwork!

Scope exclusion: The offload module (src/offload/time-utils.ts) is intentionally unchanged in this PR.

…able

Add top-level `timezone` config option (default: "system") supporting
IANA names and UTC offset strings (ECMA-402 2024).

- Introduce unified `src/utils/time.ts` module with formatForLLM,
  formatLocalDate, formatLocalDateTime, startOfLocalDay, nowInstantISO
- Converge 4 scattered time helpers into the single module
- L1 extraction / auto-recall / scene-extraction / persona-generation
  prompts now emit ISO 8601 with explicit UTC offset
- Add timezone declaration to LLM system prompts
- Local-day shard boundaries and cleaner cutoff follow configured tz
- Storage instants (SQLite/TCVDB) remain UTC — no data migration needed
- 38 unit tests covering IANA, offset, DST, half-hour zones, fallback
@Maxwell-Code07
Copy link
Copy Markdown
Collaborator

@Xuruida Thank you very much for your contribution! Thank you also to @YOMXXX for your exploratory work, and thank you for contributing high-quality code to this repository!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants