TX Sheet Control

Dates and Locales

Topic

Four things decide how a date behaves in a workbook: the stored value, the workbook's date system, the number-format code and the locale. Keep these responsibilities explicit when you import, calculate, filter or export dates. What follows covers date values and date systems, their display in cells and the date filters of dashboards.

How Dates Are Stored

Excel-compatible date values can be numeric serials. The workbook uses the 1900 or the 1904 date system, so do not reuse a serial in a different system without conversion. Time-of-day values are fractional days. Date formulas calculate values, while cell formatting determines their presentation.

ISO date text can be appropriate for application data. Arbitrary localized text is not automatically equivalent to a typed date. Prefer a deliberate conversion at the application boundary.

Display Dates

Apply an Excel-style format such as dd.mm.yyyy for a German calendar display, or another explicit supported code. The number and date locale is distinct from the interface language of the editor, described in Appearance and Localization. When reproducibility matters, supply the time zone and the locale for PDF output on the backend.

Set the Format of a Date Filter

A date filter widget on a dashboard inherits the date format and the locale of its spreadsheet source field. Override the widget's dateFilter.format if needed. Range pickers support inclusive start and end periods. Searchable date choices and the day, month or year granularity live directly in the widget.

The following code changes the date filter widget period to a range picker with day granularity and German dotted dates. dashboard is a Dashboard of the workbook:

dashboard.updateWidget('period', {
    dateFilter: { mode: 'range', granularity: 'day', format: 'dd.mm.yyyy' }
});

The code works as follows:

  • Dashboard.updateWidget updates the widget with the ID period without changing its identity. Settings the patch does not name are retained.
  • dateFilter sets the initial controls of the date filter: mode: 'range' for a range picker, granularity: 'day' for days and format: 'dd.mm.yyyy' to override the format inherited from the source field.

The analytics date comparisons support the documented serial, ISO and dotted calendar inputs. Saved filters retain their own period and granularity. A date-format override changes the presentation and parsing for that widget; it does not rewrite the source worksheet.

Test end-of-month boundaries, time portions, blanks and imported formatting.

Next Steps