@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
12 lines (11 loc) • 337 B
JavaScript
import { Temporal } from "@js-temporal/polyfill";
// Convert a UTC ISO datetime string to a Temporal.Instant.
// Returns null on failure (caller should have already validated with isValidUtc).
export function toInstantFromUtc(value) {
try {
return Temporal.Instant.from(value);
}
catch {
return null;
}
}