Skip to content

Instantly share code, notes, and snippets.

@arleighdickerson
Created July 13, 2025 17:34
Show Gist options
  • Save arleighdickerson/23645ee12596a19536f22e80a27b512e to your computer and use it in GitHub Desktop.
Save arleighdickerson/23645ee12596a19536f22e80a27b512e to your computer and use it in GitHub Desktop.
// noinspection RegExpSingleCharAlternation,RegExpUnnecessaryNonCapturingGroup
const isoEightSixZeroOne = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
export namespace jsonUtil {
export function isJsonPatch(obj: any): obj is unknown {
return false;
}
export function jsonReviver(key: string, value: any) {
return typeof value === 'string' && isoEightSixZeroOne.exec(value) ? new Date(value) : value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment