DateTime: toDate reads formatToParts by position, breaks on Hermes Android (no fractionalSecond part)
メンテナーはふだん 1 日以内に返信
@maricastroc がすでに取り組んでいます。
2026年10月3日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- android, react-native, typescript
- 領域
- mobile-dev
調査の方向性
internal/dateTime.ts の toDate から始めます。ここでは、ゾーンフォーマッターの formatToParts の出力が位置によって読み取られています。提供された Node スニペットで失敗を再現し、fractionalSecond がない場合に formatIsoDate が期待されるローカル日付を返すことを、Hermes Android 上でも確認してください。
索引モデルが issue の本文から書いたものです。
説明
What version of Effect is running?
4.0.0 (also present on main)
What steps can reproduce the bug?
toDate in internal/dateTime.ts reads the zone formatter's formatToParts output by position: parts[0] is the month, parts[2] the year, through parts[6] for the fractional second. When the runtime's Intl leaves out a part, the indices shift and a later part, such as the time zone name, ends up in a numeric slot.
Hermes on Android does this. Its Java-backed Intl ignores fractionalSecondDigits, so no fractionalSecond part is emitted and parts[6] is the timeZoneName ("GMT+10:00"). Number("GMT+10:00") is NaN, the Date becomes invalid, and anything that formats it throws. In our React Native app, every DateTime.formatIsoDate on a zoned value threw on Android.
A Node repro that simulates the missing part:
import { DateTime } from "effect"
const formatToParts = Intl.DateTimeFormat.prototype.formatToParts
Intl.DateTimeFormat.prototype.formatToParts = function(date) {
return formatToParts.call(this, date).filter((part) => part.type !== "fractionalSecond")
}
const zoned = DateTime.makeZonedUnsafe(new Date(), { timeZone: DateTime.zoneMakeLocal() })
DateTime.formatIsoDate(zoned)
What is the expected behavior?
"2026-10-03", or whatever the local date is.
What do you see instead?
RangeError: Invalid time value in Node. Hermes reports the same failure as RangeError: Date value out of bounds.
Additional information
Reading the parts by type fixes it, and falling back to the epoch's own milliseconds when fractionalSecond is absent is exact for any zone with a whole-second offset:
const parts: Partial<Record<Intl.DateTimeFormatPartTypes, string>> = {}
for (const part of self.zone.format.formatToParts(self.epochMilliseconds)) {
parts[part.type] = part.value
}
const date = new Date(0)
date.setUTCFullYear(Number(parts.year), Number(parts.month) - 1, Number(parts.day))
date.setUTCHours(
Number(parts.hour),
Number(parts.minute),
Number(parts.second),
parts.fractionalSecond === undefined
? self.epochMilliseconds - Math.floor(self.epochMilliseconds / 1000) * 1000
: Number(parts.fractionalSecond)
)
Hermes's Android Intl: lib/Platform/Intl/java/com/facebook/hermes/intl in facebook/hermes has no fractionalSecondDigits handling.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 10時間 33分
- マージ済み PR(30日)
- 830
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
RpcTest.makeClient: accept disableFatalDefects対応中かも @effect-bot が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Effect-TS/effect#9893 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
`HttpApiSchema.Upgrade`: allow a regular success for servers that don't upgrade対応中かも @effect-bot が今日担当しました。 オープンdocker-made-me-do-it enhancement
Effect-TS/effect#9912 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
docker-made-me-do-it enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
-
`HttpApiSchema`: stream bodies in a custom framing対応中かも @effect-bot が今日担当しました。 オープンdocker-made-me-do-it enhancement
Effect-TS/effect#9910 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`HttpApiSchema` streams: declare every media type a stream can be sent as対応中かも @effect-bot が今日担当しました。 オープンdocker-made-me-do-it enhancement
Effect-TS/effect#9909 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
MoonshotAI/kimi-code#4398 ·
メンテナーはふだん 1 日以内に返信
-
Xiaomi Mimo语音识别服务异常オープンpending triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
package-lock.json : les binaires natifs macOS et Linux de unrs-resolver ont disparu depuis #1823オープンbug dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
AxaFrance/design-system#2064 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100