[Bug] roundTime_locale test fails in DST-observing timezones
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- node.js, typescript
- Área
- testing-qa
Línea de trabajo
Empieza por test/ut/spec/util/time.test.ts, especialmente por getISOTimezone() y la prueba roundTime_locale, y luego ejecuta npm run test en una zona horaria que observe DST. Actualiza el manejo de la zona horaria de la prueba para que sus fechas esperadas utilicen el offset correcto para cada fecha, y confirma que toda la suite de pruebas pasa en zonas horarias que observan DST.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version
6.0.0 (bug present on current master)
Link to Minimal Reproduction
N/A — this is a test-only bug. Run npm run test in any DST-observing timezone (US, EU, Australia, NZ, Brazil, etc.).
Steps to Reproduce
- Clone apache/echarts,
npm install - Set system timezone to any DST-observing zone (e.g., America/New_York, Europe/Berlin, Australia/Sydney)
- Run
npm run test - Observe
roundTime_localetest failure intest/ut/spec/util/time.test.ts
Current Behavior
FAIL test/ut/spec/util/time.test.ts
● util/time › roundTime › roundTime_locale
expect(received).toEqual(expected) // deep equality
Expected: 528526800000
Received: 528523200000
at Object.<anonymous> (spec/util/time.test.ts:166:18)
The 3,600,000ms difference (exactly 1 hour) is the DST offset.
Expected Behavior
All unit tests should pass regardless of the machine's timezone.
Root Cause
The getISOTimezone() helper in time.test.ts computes the UTC offset from new Date(0) (January 1, 1970) and applies that fixed offset string to construct expected dates across different months:
function getISOTimezone(): string {
const offsetMinutes = (new Date(0)).getTimezoneOffset(); // ← always January offset
// ...
}
// Then used for October dates:
new Date(\`1986-10-01T00:00:00.000\${timezoneStr}\`) // ← January offset applied to October
In DST-observing timezones, the offset in January differs from October. For example, US Eastern:
- January: UTC-5 (EST)
- October: UTC-4 (EDT)
So getISOTimezone() returns -05:00, but new Date('1986-10-01T00:00:00.000-05:00') constructs midnight EST, which is 1AM EDT. Meanwhile roundTime() correctly rounds to midnight local time (EDT), producing a 1-hour mismatch.
The roundTime_UTC test passes because it uses .toISOString() which is timezone-independent.
Environment
- OS: Any (macOS, Linux, Windows)
- Node: 18+
- Timezone: Any DST-observing timezone (fails in ~70% of world timezones)
- Lenguaje dominante
- TypeScript
- Estrellas
- 67.7k
- Forks
- 19.9k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoen pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoen pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectPosiblemente ocupada @waterWang la tomó hace 98 días. Abiertobug en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Todos los issues de apache/echarts
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
mike-north/AgentMonitors#648 ·
Los mantenedores suelen responder en 1 día
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
vercel-labs/ui#700 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días