@snups/rjsf-utils
Version:
Utility functions for @snups/rjsf-core
9 lines (8 loc) • 373 B
text/typescript
/** 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;
}