Skip to content

Date and time picker ​

Introduction ​

This picker chooses a calendar day and a time of day. Its panel has the calendar and two scrolling columns, one for hours and one for minutes.

Basic usage ​

The value is one instant, as an ISO timestamp with the time zone's offset. It's Nepal time by default.

tsx
import { useState } from 'react';
import { DateTimePicker } from '@nepdatejs/react';

export function Meeting() {
  const [startsAt, setStartsAt] = useState('');

  return (
    <DateTimePicker
      value={startsAt}
      onChange={setStartsAt}
      minuteStep={15}
      defaultTime="09:00"
      aria-label="Starts at"
    />
  );
}
html
<nep-date-time-picker
  name="starts-at"
  minute-step="15"
  default-time="09:00"
  label="Starts at"
></nep-date-time-picker>

Choosing 1 Kartik 2083 at 2:30 PM gives:

text
2026-10-18T14:30:00+05:45

The value stays '' until both the date and the time are valid. If someone picks a day first, the time becomes defaultTime, which is midnight unless you set it.

Reading the value ​

The callback's second argument splits the value into parts:

tsx
<DateTimePicker
  onChange={(value, detail) => {
    console.log(value); // "2026-10-18T14:30:00+05:45"
    console.log(detail?.ad, detail?.bs); // the day in both calendars
    console.log(detail?.time); // { hour: 14, minute: 30 }
  }}
/>;

On the element, change has event.detail with value, ad, bs and time.

Time options ​

PropAttributeDefaultMeaning
hour12hour12falseShow 2:30 PM instead of 14:30
minuteStepminute-step5Minutes between choices, 1 to 30
defaultTimedefault-time'00:00'The time used when a day is picked first
timeZonetime-zoneNepalThe zone shown and stored
timeLabeltime-labelAccessible name of the time input
tsx
<DateTimePicker hour12 minuteStep={30} />;
html
<nep-date-time-picker hour12 minute-step="30"></nep-date-time-picker>

The time field accepts typing too, such as 14:30, 2:30 pm, 1430 or २:३० अपराह्न. See parseTime.

Time zones ​

The value carries its offset, so it's a real instant that any server can read. To show and store a different zone, use timeZone:

tsx
<DateTimePicker timeZone="Asia/Dubai" />;
html
<nep-date-time-picker time-zone="Asia/Dubai"></nep-date-time-picker>

A value with no offset, such as 2026-10-18T14:30, is read as a wall-clock time in that zone. A value with an offset or Z is converted to it.

Forms ​

The name field submits the whole timestamp:

html
<nep-date-time-picker name="starts-at"></nep-date-time-picker>
text
starts-at=2026-10-18T14:30:00+05:45

Options ​

DateTimePicker also takes the shared calendar, defaultCalendar, min, max, isDateDisabled, holidays, presets, locale, weekStartsOn, mask, inline, panelLayout, name, id, required, disabled, theme, className and today.

min and max limit the day, not the time. Use your own check if you need to limit the time as well.

Released under the MIT licence.