UNPKG

@snups/rjsf-utils

Version:
9 lines (8 loc) 373 B
/** Converts a local Date string into a UTC date string * * @param dateString - The string representation of a date as accepted by the `Date()` constructor * @returns - A UTC date string if `dateString` is truthy, otherwise undefined */ export default function localToUTC(dateString: string) { return dateString ? new Date(dateString).toJSON() : undefined; }