Time, date-time and calendar editors
The time / datetime editors and date's picker calendar (reading typed text, the calendar, a list of times, a time input for date-times)
These are the time (editor: { type: 'time' }) and date-time ({ type: 'datetime' }) editors and the date calendar ({ type: 'date', picker: 'calendar' }) (since 1.11.0). In all of them, the cell itself becomes a text input, and they read input such as 930, 9時30分, 3pm, 12/5, 1205 and 2026年12月5日. The date default (no picker) stays the browser's <input type="date">, so upgrading doesn't change the look of existing columns.
Demo (shift table)
- Work day — a calendar date (
picker: 'calendar'). Opening shows a calendar below. Type12/24or1224and the calendar moves to that month and marks the day; commit withEnter(without a year it's this year). Pressing a day also commits. Press the month name for a list of months, and again for a list of years. - Start — a time (
type: 'time'). Type930and pressEnterfor09:30.↑/↓move 15 minutes at a time. - End — a time +
strict: true. Trying to commit text it can't read (25:00and so on) shows "Enter a time (e.g. 9:30)" and keeps editing. Pasted text it can't read gets a mark. - Break — a list of times every 30 minutes (
picker: 'list',step: 30). The current value is highlighted, and pressing one commits. - Checked at — a date-time (
type: 'datetime') + a time input under the calendar (timeInput: true). Pressing a day changes only the date and keeps editing, so fix the time in the time input and commit withEnter. Typing only a time such as13:15keeps the cell's date; typing only a date such as12/5usesdefaultTime(09:00in this example).
Usage
import { SpreadsheetGrid, type GridColumn } from '@ishibashi0112/spreadsheet-grid';
type Shift = { id: number; day: string | null; start: string | null; rest: string | null; checkedAt: string | null };
const columns: GridColumn<Shift>[] = [
{ key: 'day', title: 'Work day', width: 120, editable: true, editor: { type: 'date', picker: 'calendar' } },
{ key: 'start', title: 'Start', width: 80, editable: true, editor: { type: 'time' } },
{ key: 'rest', title: 'Break', width: 80, editable: true, editor: { type: 'time', picker: 'list', step: 30 } },
{
key: 'checkedAt',
title: 'Checked at',
width: 160,
editable: true,
editor: { type: 'datetime', defaultTime: '09:00', timeInput: true },
},
];
<SpreadsheetGrid rows={rows} onRowsChange={setRows} columns={columns} />;Value shapes
| Editor | Value | Text in cells, copy and CSV |
|---|---|---|
date | 'YYYY-MM-DD' | The value as is |
time | 'HH:mm' (24-hour, no seconds) | The value as is |
datetime | 'YYYY-MM-DDTHH:mm' (no time zone, no seconds) | 'YYYY-MM-DD HH:mm' (when there is no valueFormatter) |
Dragging the fill handle continues times by 1 hour (by the minute interval when there are two or more) and date-times by 1 day.
Empty cells are null. These are "wall clock times" without a time zone, so add a time zone when sending them to a server if you need one. To change the display format, use the column's valueFormatter as before. The global filter matches both a datetime column's value (2026-12-05T09:30) and the text on screen (2026-12-05 09:30).
How typed text is read
- Times:
930(9:30),9(9:00),1745,9:30,9.30,9時30分,9時半,午後3時,3pm, full-width digits. - Dates:
2026/12/5,2026-12-05,2026年12月5日,20261205,12/5,1205(this year if no year). - Date-times: a date and time joined with a space or
T(12/5 9:30,2026年12月5日 9時). A date only usesdefaultTime(default'00:00'); a time only uses that time on the cell's current date (today if empty). Typing only digits in a date-time column reads them as a date (930is September 30). To type only a time, add a time marker, as in9:30,9時30分or3pm.
Paste and the default parser read more narrowly than the editors. Times: 9:30, 09:30:00, 9:30 PM, 9時30分 and full-width digits; dates: 2026/12/5, 2026-12-05 and 12/5/2026 with a year. Digits alone such as "930" or "1205" (so quantities and codes aren't mistaken for times or dates), "12/24" without a year, kanji such as "2026年12月24日", 午後3時, 3pm and 10.30 aren't read. Text that can't be read goes in as is, so write strict: true if you want it marked (Validation).
Keys
| Key | What happens |
|---|---|
Enter | Commit and move in the editorEnterMove direction (pressed without typing, the current value stays) |
Tab / Shift+Tab | Commit and move right / left |
Escape | Cancel |
↑ / ↓ | Later / earlier (date by 1 day, time by step minutes; in a datetime, the cell's input moves 1 day and the time input step minutes. Empty cells start from today / now). With the list of times (picker: 'list'), it follows the list's direction, so ↓ is down the list = later. There's no moving inside the calendar with arrows (moving the day moves the mark too. To jump by weeks or months, type a date) |
Ctrl / ⌘+Enter | Write to the whole selected range (excelShortcuts, see Excel keys) |
When focus moves outside the grid, readable text is committed and unreadable text is cancelled (with no notice). Trying to commit unreadable text shows a notice at the top of the calendar / list of times (in a bubble below the editor for time without a list) and keeps editing (the texts are enterDate / enterTime / enterDateTime in localeText).
Options
| Option | For | Default | Description |
|---|---|---|---|
picker | date | 'native' | 'calendar' makes the cell a text input with a calendar below |
picker | time | No list | 'list' shows a list of times every step minutes below the input |
step | time / datetime | 15 | Minutes moved by ↑ / ↓ (1–720). The interval of the list of times |
defaultTime | datetime | '00:00' | The time used when only a date is typed or a day is pressed in a cell without a time (also used for the text of cells whose value is a date only) |
timeInput | datetime | false | true shows a time input under the calendar |
strict | date / time / datetime | false | true marks values that can't be read |
Touch devices
On devices where touch is primary (pointer: coarse), opening with double-tap / F2 / Enter opens the browser's input (date / time / date-time) (easier to pick with than a soft keyboard). Starting by typing opens a text input.
With /lite
import { createSpreadsheetGrid, dateTimeEditorsFeature } from '@ishibashi0112/spreadsheet-grid/lite';
const Grid = createSpreadsheetGrid({ features: { dateTimeEditors: dateTimeEditorsFeature } });Without the feature, time / datetime open as a text input (the default parser reads the committed text), and dates with picker: 'calendar' open as the browser's date input (one warning in development). The value shape, cell text, paste and strict are in the core, so they stay the same. The calendar part loads when opened (preloadGridPopups() can load it ahead too).
Details are in the API reference.
Multi-select
Choose any number of options in one cell with the select editor's multiple (chips, a checked list, copy and paste, column filters)
Validation
Validate values with validate and the number editor's range, choose between marking and refusing the write (mark / reject), and check everything before saving