#171 #171 #171 #171 #171 #171 #171 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #345
This commit was merged in pull request #345.
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
import type { FC, FocusEvent } from 'react'
|
||||
import type { ComponentPropsWithoutRef, FC, FocusEvent } from 'react'
|
||||
|
||||
|
||||
const pad = (n: number): string => n.toString ().padStart (2, '0')
|
||||
@@ -18,14 +18,14 @@ const toDateTimeLocalValue = (d: Date) => {
|
||||
}
|
||||
|
||||
|
||||
type Props = {
|
||||
type Props = Omit<ComponentPropsWithoutRef<'input'>, 'onChange'> & {
|
||||
value?: string
|
||||
onChange?: (isoUTC: string | null) => void
|
||||
className?: string
|
||||
onBlur?: (ev: FocusEvent<HTMLInputElement>) => void }
|
||||
|
||||
|
||||
export default (({ value, onChange, className, onBlur }: Props) => {
|
||||
export default (({ value, onChange, className, onBlur, ...rest }: Props) => {
|
||||
const [local, setLocal] = useState ('')
|
||||
|
||||
useEffect (() => {
|
||||
@@ -34,6 +34,7 @@ export default (({ value, onChange, className, onBlur }: Props) => {
|
||||
|
||||
return (
|
||||
<input
|
||||
{...rest}
|
||||
className={cn ('border rounded p-2', className)}
|
||||
type="datetime-local"
|
||||
value={local}
|
||||
|
||||
Reference in New Issue
Block a user