feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -0,0 +1,46 @@
export function formatScheduledDate(value, options = {}) {
if (!value) return 'Not scheduled'
const date = new Date(value)
if (Number.isNaN(date.getTime())) return 'Not scheduled'
try {
return date.toLocaleString(undefined, {
month: 'short',
day: 'numeric',
...(options.includeYear === false ? {} : { year: 'numeric' }),
hour: 'numeric',
minute: '2-digit',
...(options.timeZone ? { timeZone: options.timeZone } : {}),
})
} catch {
return date.toLocaleString()
}
}
export function formatReleaseCountdown(value, nowMs = Date.now()) {
if (!value) return 'Not scheduled'
const releaseDate = new Date(value)
if (Number.isNaN(releaseDate.getTime())) return 'Not scheduled'
const remainingMs = releaseDate.getTime() - nowMs
if (remainingMs <= 0) {
return 'Releasing now'
}
const totalSeconds = Math.floor(remainingMs / 1000)
const days = Math.floor(totalSeconds / 86400)
const hours = Math.floor((totalSeconds % 86400) / 3600)
const minutes = Math.floor((totalSeconds % 3600) / 60)
const seconds = totalSeconds % 60
const parts = []
if (days > 0) parts.push(`${days}d`)
if (days > 0 || hours > 0) parts.push(`${hours}h`)
if (days > 0 || hours > 0 || minutes > 0) parts.push(`${minutes}m`)
if (days === 0) parts.push(`${seconds}s`)
return `In ${parts.join(' ')}`
}