Skip to content

fix: honor explicit offsets with region time zones - #7975

Open
dongyikuan919 wants to merge 1 commit into
alibaba:mainfrom
dongyikuan919:fix/zoned-datetime-explicit-offset
Open

dongyikuan919 wants to merge 1 commit into
alibaba:mainfrom
dongyikuan919:fix/zoned-datetime-explicit-offset

Conversation

@dongyikuan919

Copy link
Copy Markdown

What this PR does / why we need it?

Refs #7974. An explicit offset in an ISO text value specifies the instant, but Fastjson2 could discard it when a named region was also present. During a daylight-saving overlap, parsing 2024-10-27T02:30:00+01:00[Europe/Paris] returned the earlier +02:00 occurrence. The Z[Europe/London] form also discarded the region.

Summary of your change

In both text parser paths, determine the instant from the supplied offset and represent it in the supplied region. This PR covers reading text values that already contain both fields. Write-side preservation and JSONB are still tracked in #7974.

Three regression cases reproduced the old behavior and now pass for String, UTF-16 char[], and UTF-8 byte[] inputs. The four affected test classes passed 160 tests through the Maven core reactor on JDK 17 with zero Checkstyle violations. A separate JDK 8 smoke run verified the three cases through all three input types.

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.
中文说明

关联 #7974。ISO 文本同时包含明确偏移和地区时区时,解析使用偏移确定实际时刻,并保留地区时区。本次改动覆盖文本读取,序列化与 JSONB 问题继续由 #7974 跟踪。

新增巴黎、伦敦和纽约的回拨用例,验证 String、char[] 和 byte[] 输入。JDK 17 的 Maven core 相关测试共 160 项通过,Checkstyle 无违规。JDK 8 也单独验证了三个用例。

OpenAI Codex assisted with reproduction, implementation, and testing.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant