+ {/* Genuine Glass Backdrop Blurring Blobs */}
+
+
+ {/* Top Navigation: Mode Selector + Toggle Sidebar Trigger */}
+
+ {/* Segmented Modes Tabs with heightened contrast on inactive ones */}
+
+ {['convert', 'batch', 'diff', 'cron'].map((m) => (
+
+ ))}
+
+
+ {/* Connected Trigger Button that controls sidebar */}
-
-
-
-
-
- setIso(e.target.value)}
- />
-
-
-
+
+ {/* Main layout containing the workspace and collapsible history sidebar */}
+
+ {/* Scroll Constrained Workspace Panel */}
+
+ {/* CONVERT MODE */}
+ {activeMode === 'convert' && (
+
+
+
+ setConvertInput(e.target.value)}
+ />
+
+
+
+
+ {parsedDate ? (
+
+ {/* Raw Group */}
+
+
Raw Unix Timestamps
+
+
+
+
+
+
+ {/* Standard Group */}
+
+
Standard UTC Formats
+
+
+
+
+
+
+ {/* Localized Group */}
+
+
+
Localized Dates
+ {/* Custom-styled Dropzone Selection for timezone */}
+
+ ({ label: tz, value: tz }))}
+ onChange={(tz) => {
+ setSelectedTz(tz);
+ if (!customTzs.includes(tz)) {
+ setCustomTzs([...customTzs, tz]);
+ }
+ }}
+ />
+
+
+
+ {/* TZ Pinned Pills */}
+
+ {customTzs.map((tz) => (
+
+ ))}
+
+
+
+
+
+
+
+
+
+
+
+ ) : (
+
+ ⚠️ {parseStatus}
+
+ )}
+
+ )}
+
+ {/* BATCH MODE */}
+ {activeMode === 'batch' && (
+
+
+
+
+
+ {batchMatches.length > 0 ? (
+
+
+ Found {batchMatches.length} parsed timestamp{batchMatches.length === 1 ? '' : 's'}:
+
+
+
+
+
+
+ | Original |
+ ISO 8601 |
+ Local Time |
+ Relative |
+
+
+
+ {batchMatches.map((m, idx) => (
+
+ | handleCopy(m.original)}
+ style={{ padding: 10, color: 'var(--ink)', cursor: 'pointer' }}
+ >
+ {m.original}
+ |
+ handleCopy(m.iso)}
+ style={{ padding: 10, color: 'var(--ink)', cursor: 'pointer' }}
+ >
+ {m.iso}
+ |
+ handleCopy(m.date.toLocaleString())}
+ style={{ padding: 10, color: 'var(--ink-soft)', cursor: 'pointer' }}
+ >
+ {m.date.toLocaleString()}
+ |
+ handleCopy(getRelativeTime(m.date))}
+ style={{ padding: 10, color: 'var(--ink-mute)', cursor: 'pointer' }}
+ >
+ {m.relative}
+ |
+
+ ))}
+
+
+
+
+ ) : (
+
+ No valid timestamps detected yet. Paste logs with epoch seconds/ms.
+
+ )}
+
+ )}
+
+ {/* DIFF & DURATION MODE */}
+ {activeMode === 'diff' && (
+
+ {/* Diff Sub-Selector */}
+
+
+
+
+
+ {diffMode === 'range' ? (
+
+
+
+
+
+
+ setDiffDate1(e.target.value)} />
+
+
+ {d1 && (
+
+ Resolved: {d1.toISOString()} (Local: {d1.toLocaleString()})
+
+ )}
+
+
+
+
+
+
+
+ setDiffDate2(e.target.value)} />
+
+
+ {d2 && (
+
+ Resolved: {d2.toISOString()} (Local: {d2.toLocaleString()})
+
+ )}
+
+
+
+
+
+ {d1 && d2 ? (
+
+
+ Calculated Difference
+
+
+
+
+
+
+
+
+
+ ) : (
+
+ Please enter two valid datetime inputs.
+
+ )}
+
+ ) : (
+
+
+
+
+
+ setDiffBase(e.target.value)} />
+
+
+
+
+
+
+ setDiffOffset(e.target.value)}
+ style={{
+ borderColor: isValidOffset ? 'var(--line)' : 'rgba(239, 68, 68, 0.6)',
+ boxShadow: isValidOffset ? 'none' : '0 0 0 2px rgba(239, 68, 68, 0.2)',
+ }}
+ />
+ {!isValidOffset && (
+
+ Invalid offset format. Use e.g. +2h, -30m, +1y 2mo 15d
+
+ )}
+
+
+
+
+ {offsetResult ? (
+
+
+ Calculated Result Date
+
+
+
+
+
+
+
+
+ ) : (
+
+ Please input a valid Base Date and Offset string.
+
+ )}
+
+ )}
+
+ )}
+
+ {/* CRON EXPLANATOR & NEXT RUNS */}
+ {activeMode === 'cron' && (
+
+
+
+
+
setCronInput(e.target.value)} placeholder="*/5 * * * *" />
+
+ ({ label: tz, value: tz }))}
+ onChange={(tz) => setSelectedTz(tz)}
+ />
+
+
+ {/* Preset buttons */}
+
+
+
+
+
+
+
+
+
+
+
+ Schedule Description
+
+
+ ✦ {cronDesc}
+
+
+
+ Next 5 Scheduled Runs ({selectedTz})
+
+ {cronRuns.length > 0 ? (
+
+ {cronRuns.map((run, i) => (
+
handleCopy(formatLocal(run, selectedTz, 'all'))}
+ style={{
+ display: 'flex',
+ justifyContent: 'space-between',
+ padding: '8px 10px',
+ background: 'var(--surface-input)',
+ borderRadius: 8,
+ cursor: 'pointer',
+ fontSize: 13,
+ }}
+ >
+ Run #{i + 1}
+ {formatLocal(run, selectedTz, 'all')}
+
+ ))}
+
+ ) : (
+
Could not compute next runs. Check expression.
+ )}
+
+
+ )}
+
+
+ {/* COLLAPSIBLE SESSION HISTORY SIDEBAR */}
+
+ {historyOpen && (
+
+
+ Recent Session History
+
+
+
+ {historyList.length > 0 ? (
+ historyList.map((item) => (
+
{
+ if (item.mode === 'convert' && item.data.q) {
+ setConvertInput(item.data.q);
+ setActiveMode('convert');
+ } else if (item.mode === 'diff' && item.data.d1 && item.data.d2) {
+ setDiffDate1(item.data.d1);
+ setDiffDate2(item.data.d2);
+ setActiveMode('diff');
+ } else if (item.mode === 'cron' && item.data.cron) {
+ setCronInput(item.data.cron);
+ setActiveMode('cron');
+ }
+ }}
+ style={{
+ padding: '10px 12px',
+ background: 'var(--surface-input)',
+ borderRadius: 8,
+ cursor: 'pointer',
+ fontSize: 12,
+ transition: 'all 0.15s ease',
+ border: '1px solid transparent',
+ }}
+ onMouseEnter={(e) => e.currentTarget.style.borderColor = 'var(--accent)'}
+ onMouseLeave={(e) => e.currentTarget.style.borderColor = 'transparent'}
+ >
+
+
+ {item.mode}
+
+
+ {new Date(item.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
+
+
+
+ {item.label}
+
+
+ {item.details}
+
+
+ ))
+ ) : (
+
No recent conversions.
+ )}
+
+
+ )}
+
+
+ {/* ── CODE GENERATION FLYOUT POPOVER ── */}
+
+ {flyoutValue && flyoutDate && (
+
+
+
+ Copy as Code Snippet
+
+
+
+ {[
+ { label: 'JavaScript (Date)', code: `new Date(${flyoutDate.getTime()})` },
+ { label: 'JavaScript (ISO)', code: `new Date("${flyoutDate.toISOString()}")` },
+ { label: 'Python (datetime)', code: `from datetime import datetime\ndatetime.fromtimestamp(${Math.floor(flyoutDate.getTime() / 1000)})` },
+ { label: 'PostgreSQL', code: `SELECT to_timestamp(${Math.floor(flyoutDate.getTime() / 1000)});` },
+ { label: 'MongoDB', code: `ISODate("${flyoutDate.toISOString()}")` },
+ { label: 'Go (time.Unix)', code: `time.Unix(${Math.floor(flyoutDate.getTime() / 1000)}, 0)` },
+ ].map((option, idx) => (
+
handleCopySnippet(option.code, idx)}
+ style={{
+ padding: 10,
+ borderRadius: 8,
+ background: 'rgba(255, 255, 255, 0.04)',
+ border: '1px solid var(--divider)',
+ cursor: 'pointer',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 4,
+ transition: 'all 0.15s ease',
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = 'var(--accent)';
+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = 'var(--divider)';
+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
+ }}
+ >
+
+ {option.label}
+
+ {copiedSnippetIndex === idx ? '✓ Copied!' : 'Click to copy'}
+
+
+
+ {option.code}
+
+
+ ))}
+
+
+
+ )}
+
);
}
+
+// ── Shared Subcomponents ──
+
+function ValueRow({
+ label,
+ value,
+ date,
+ onCopy,
+ onCode,
+}: {
+ label: string;
+ value: string;
+ date: Date;
+ onCopy: (val: string) => void;
+ onCode?: (e: React.MouseEvent, val: string, d: Date) => void;
+}) {
+ return (
+
onCopy(value)}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ padding: '8px 10px',
+ borderRadius: 8,
+ cursor: 'pointer',
+ transition: 'all 0.15s ease',
+ background: 'transparent',
+ }}
+ onMouseEnter={(e) => (e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)')}
+ onMouseLeave={(e) => (e.currentTarget.style.background = 'transparent')}
+ >
+
+ {label}
+
+
+
+ {value}
+
+ {onCode && (
+
+ )}
+
+
+ );
+}