Skip to content

instantFormat

The parts of the date and time an instant column shows.

TypeInstantFormatSpec
Defaultnot set
Live update (update())Yes — give the columns again (update({ columns }))
Declared inpackages/core/src/columns/defs.ts

date: false shows the time only, time: false the date only, seconds: true adds the seconds. By default the date and the time are shown, without seconds, on a 24-hour clock, in the order of the grid’s locale and in its timeZone.

It changes what the cell shows only: sorting and filtering use the moment itself.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Lap = { id: string; runner: string; start: number; finish: number };
createGrid<Lap>(document.getElementById('laps')!, {
rows: [{ id: 'l1', runner: 'Maud Hesketh', start: 1772442000000, finish: 1772442754000 }],
columns: [
{ id: 'runner', header: 'Runner' },
{ id: 'start', header: 'Start', type: 'instant', instantFormat: { date: false } },
{ id: 'finish', header: 'Finish', type: 'instant', instantFormat: { date: false, seconds: true } },
],
getRowId: (r) => r.id,
messages: EN,
});