DateTime: toDate reads formatToParts by position, breaks on Hermes Android (no fractionalSecond part)
I maintainer di solito rispondono entro 1 giorno
@maricastroc ci sta già lavorando.
Dal 3/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- android, react-native, typescript
- Ambito
- mobile-dev
Direzione di ricerca
Inizia in internal/dateTime.ts, in toDate, dove l'output di formatToParts del formatter del fuso orario viene letto in base alla posizione. Riproduci il malfunzionamento con lo snippet Node fornito, quindi verifica che formatIsoDate restituisca la data locale prevista quando fractionalSecond è assente, anche su Hermes Android.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 10h 22m
- PR unite (30g)
- 771
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)Forse già presa @santiago-ramos-02 l’ha presa 19 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Effect-TS/effect#8635 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Support {self: this} for fnUntracedForse di nuovo libera @ArjunCodess l’ha presa 30 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Effect-TS/effect#8101 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
HashMap.set keeps the old value when the new one is Equal to itForse già presa @schutzelaars l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
OpenApi: optional query and header parameters are documented as nullableForse già presa @Marve10s l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
area: aria/combobox gemini-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
angular/components#33973 ·
I maintainer di solito rispondono entro 1 giorno
-
bug priority: P2
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
[bug] status, list and push crash with an uncaught NotInitializedError stack trace when teamai is not initializedForse già presa @jay23606 l’ha presa oggi. Apertabug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Tencent/teamai-cli#1227 ·
I maintainer di solito rispondono entro 1 giorno
-
[Tool]: YapAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
withkarann/aifoxx#417 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
sindresorhus/eslint-plugin-unicorn#3921 ·
I maintainer di solito rispondono entro 1 giorno