Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Masquer les espaces
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Styles de texte
Modifier l’apparence
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Gantt Date Normalization
Créé
il y a 3 mois
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
2 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
18 lignes
Copier tout
45 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
57 lignes
Copier tout
/**
/**
* Stable date conversion helpers for Gantt ↔ Supabase round-trips.
* Stable date conversion helpers for Gantt ↔ Supabase round-trips.
*
*
* The Gantt component works with JS Date objects.
* The Gantt component works with JS Date objects.
* Supabase stores timestamptz as ISO-8601 strings.
* Supabase stores timestamptz as ISO-8601 strings.
*/
*/
Copier
Copié
Copier
Copié
/** Convert a JS Date
to an ISO-8601 string for Supabase. */
export function dateToISO(d: Date |
null | undefined): string | null {
function parseGanttDateString(value: string): Date | null {
if (!d) return null;
const match = value.match(
return
d
.toISOString();
/^(\d{2})-(\d{2})-(\d{4})(?:\s+(\d{2}):(\d{2})(?::(\d{2}))?)?$/,
);
if (!match) return null;
const [, day, month, year, hours = "00", minutes = "00", seconds = "00"] = match;
const date = new Date(
Number(year),
Number(month) - 1,
Number(day),
Number(hours),
Number(minutes),
Number(seconds),
);
return Number.isNaN(date.getTime()) ? null : date;
}
/** Convert a JS Date
or supported Gantt string
to an ISO-8601 string for Supabase. */
export function dateToISO(d: Date |
string |
null | undefined): string | null {
if (!d) return null;
if (d instanceof Date) {
return Number.isNaN(d.getTime()) ? null : d.toISOString();
}
if (typeof d === "string") {
const parsed = parseGanttDateString(d) ?? new Date(d);
return
Number.isNaN(parsed.getTime()) ? null : parsed
.toISOString();
}
return null;
}
}
Copier
Copié
Copier
Copié
/** Convert an ISO-8601 string (or null) to a JS Date for Gantt. */
/** Convert an ISO-8601 string (or null) to a JS Date for Gantt. */
export function isoToDate(s: string | null | undefined): Date {
export function isoToDate(s: string | null | undefined): Date {
if (!s) return new Date();
if (!s) return new Date();
return new Date(s);
return new Date(s);
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
/** * Stable date conversion helpers for Gantt ↔ Supabase round-trips. * * The Gantt component works with JS Date objects. * Supabase stores timestamptz as ISO-8601 strings. */ /** Convert a JS Date to an ISO-8601 string for Supabase. */ export function dateToISO(d: Date | null | undefined): string | null { if (!d) return null; return d.toISOString(); } /** Convert an ISO-8601 string (or null) to a JS Date for Gantt. */ export function isoToDate(s: string | null | undefined): Date { if (!s) return new Date(); return new Date(s); }
Texte modifié
Ouvrir un fichier
/** * Stable date conversion helpers for Gantt ↔ Supabase round-trips. * * The Gantt component works with JS Date objects. * Supabase stores timestamptz as ISO-8601 strings. */ function parseGanttDateString(value: string): Date | null { const match = value.match( /^(\d{2})-(\d{2})-(\d{4})(?:\s+(\d{2}):(\d{2})(?::(\d{2}))?)?$/, ); if (!match) return null; const [, day, month, year, hours = "00", minutes = "00", seconds = "00"] = match; const date = new Date( Number(year), Number(month) - 1, Number(day), Number(hours), Number(minutes), Number(seconds), ); return Number.isNaN(date.getTime()) ? null : date; } /** Convert a JS Date or supported Gantt string to an ISO-8601 string for Supabase. */ export function dateToISO(d: Date | string | null | undefined): string | null { if (!d) return null; if (d instanceof Date) { return Number.isNaN(d.getTime()) ? null : d.toISOString(); } if (typeof d === "string") { const parsed = parseGanttDateString(d) ?? new Date(d); return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString(); } return null; } /** Convert an ISO-8601 string (or null) to a JS Date for Gantt. */ export function isoToDate(s: string | null | undefined): Date { if (!s) return new Date(); return new Date(s); }
Trouver la différence