mirror of
https://github.com/supabase/supabase.git
synced 2026-05-10 10:50:18 -04:00
16 lines
445 B
TypeScript
16 lines
445 B
TypeScript
import { type ReactNode } from 'react'
|
|
|
|
export function ShowUntil({ children, date }: { children: ReactNode; date: string }) {
|
|
const currentDate = new Date()
|
|
const untilDate = new Date(date)
|
|
|
|
if (isNaN(untilDate.getTime()) || currentDate < untilDate) {
|
|
return <>{children}</>
|
|
} else {
|
|
console.error(
|
|
`[docs/features/ui/ShowUntil]: Component for ${date} expired, please update remove this note.`
|
|
)
|
|
return null
|
|
}
|
|
}
|