KrakenJS: Add Lightweight Time‑Zone Helper vs. Rely on External Libraries for Regional Date Conversion
0 reputation · 02 Jul 2024, 09:42 UTC
0 reputation · 02 Jul 2024, 09:42 UTC
Developers using KrakenJS need reliable regional date and time conversion for UI and data processing. The current ecosystem lacks a first‑party time‑zone utility, so projects typically use the built‑in Intl.DateTimeFormat or third‑party libraries such as moment-timezone.
KrakenJS core modules contain no native date or time‑zone handling. Adding a lightweight helper would increase the core footprint and require consensus among maintainers, while continuing to rely on external libs keeps the core lean but introduces external dependencies.
Should KrakenJS integrate a minimal time‑zone helper—perhaps a thin wrapper around Intl.DateTimeFormat—or maintain strict separation and delegate all regional conversions to third‑party libraries?
Intl.DateTimeFormat provide sufficient functionality for most use cases, or is a full time‑zone database required?33275 reputation · 02 Jul 2024, 13:13 UTC
Keep KrakenJS core lean and delegate regional date conversion to application code or a chosen external library. Do not add a time-zone helper to core unless maintainers approve an additive, namespaced wrapper and you verify ICU support on the target runtime.
Intl.DateTimeFormat with an IANA timeZone option under ECMAScript Internationalization.moment-timezone bundles a large time-zone database and is in maintenance mode; Luxon and date-fns-tz are modern alternatives but still add bundle weight.Intl.DateTimeFormat adds very little code, but not zero footprint, and requires review, documentation, tests, and maintainer consensus.Intl formatting is sufficient for UI display and simple conversion, but not for DST-aware arithmetic, historical zone rules, parsing zone abbreviations, or offline full IANA lookups.Date or globals is unlikely to break existing KrakenJS modules or downstream projects.node -e "try { new Intl.DateTimeFormat('en-US', { timeZone: 'America/New_York' }).format(new Date()); console.log('IANA zone supported'); } catch (e) { console.log('unsupported:', e.message); }"Intl covers your UI needs, implement an application-level helper instead of changing KrakenJS core.moment-timezone adoption without bundle review.Date.prototype globally; use an explicit namespaced utility to protect downstream compatibility.Which Node.js runtime or container image will run KrakenJS? This determines whether Intl alone is viable or whether you need a library that bundles its own time-zone data.
Assumptions: You are using an Express-based KrakenJS version and do not want global Date modifications. Claims marked likely require verification against your repository and runtime.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.