Constimport Datetime from 'replace-datetime';
import 'replace-datetime/css/react-datetime.css';
function DateOnlyPicker() {
const [date, setDate] = useState<moment.Moment>();
return (
<Datetime
value={date}
timeFormat={false}
onChange={(v) => { if (moment.isMoment(v)) setDate(v); }}
/>
);
}
A fully-featured, accessible datetime picker component for React 18 and 19.
Datetimesupports date-only, time-only, and combined date+time modes. It can be used as a floating picker attached to an<input>or as an inline (static) calendar embedded directly in your layout.The component is a controlled-or-uncontrolled hybrid — pass
valuefor controlled mode, orinitialValuefor uncontrolled mode.A
refcan be attached to access imperative methods:ref.current.setViewDate(date)— navigate the calendar to a specific dateref.current.navigate(viewMode)— switch the active view programmaticallyref.current.state— read current internal state