Skip to main content

localization

Description

Optional. Defines the format of numbers, dates, time and currency

Usage

localization?: object;

Parameters

The localization object may contain the following properties:

  • decimal - (optional) the symbol used as a decimal separator, "." by default.
    Possible values are "." | ","
  • thousands - (optional) the symbol used as a thousands separator, "," by default.
    Possible values are "." | "," | " " | ""
  • currency - (optional) the currency sign, "$" by default
  • dateFormat - (optional) the format of displaying dates set as a string. The default format is "%d/%m/%Y". Check details below
  • timeFormat - (optional) the format of displaying time set as either 12 or 24. The default format is 12

Default config

const defaultLocales = {
decimal: ".",
thousands: ",",
currency: "$",
dateFormat: "%d/%m/%Y",
timeFormat: 12,
};

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {
localization: {
decimal: ",",
thousands: " ",
currency: "¥",
dateFormat: "%D/%M/%Y",
timeFormat: 24
}
});

spreadsheet.parse(dataset);

Characters for setting date format

DHTMLX Spreadsheet uses the following characters for setting a date format:

CharacterDefinition
%dday as a number with leading zero, 01..31
%jday as a number, 1..31
%Dshort name of the day, Su Mo Tu...
%lfull name of the day, Sunday Monday Tuesday...
%mmonth as a number with leading zero, 01..12
%nmonth as a number, 1..12
%Mshort name of the month, Jan Feb Mar...
%Ffull name of the month, January February March...
%yyear as a number, 2 digits
%Yyear as a number, 4 digits
%hhours 12-format with leading zero, 01..12)
%ghours 12-format, 1..12)
%Hhours 24-format with leading zero, 00..23
%Ghours 24-format, 0..23
%iminutes with leading zero, 01..59
%sseconds with leading zero, 01..59
%aam or pm
%AAM or PM
%umilliseconds

Change log:

  • Added in v5.1

Related article: Number, date, time, currency localization