You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Pivot accepts a date that is parsed into the Date object. By default, the `dateFormat` of the current locale is applied. To redefine the format, change the value of the `dateFormat` parameter in the `formats` object of the [`locale`](/api/config/locale-property). The default format is "%d.%m.%Y".
309
-
310
-
### Example
311
-
312
-
~~~jsx {17}
313
-
functionsetFormat(value) {
314
-
table.setConfig({ locale: { formats: { dateFormat: value } } });
Copy file name to clipboardExpand all lines: docs/guides/localization.md
+133Lines changed: 133 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,139 @@ const ko = {...} //object with locale
185
185
widget.setLocale(ko);
186
186
~~~
187
187
188
+
## Date formatting
189
+
190
+
Pivot accepts a date that is parsed into the Date object. By default, the `dateFormat` of the current locale is applied. To redefine the format for all date fields in Pivot, change the value of the `dateFormat` parameter in the `formats` object of the [`locale`](/api/config/locale-property). The default format is "%d.%m.%Y".
191
+
192
+
Example:
193
+
194
+
~~~jsx {17}
195
+
functionsetFormat(value) {
196
+
table.setConfig({ locale: { formats: { dateFormat: value } } });
In case you need to set format to a specific field, use the template parameter of the [`tableShape`](/api/config/tableshape-property) or [`headerShape`](/api/config/headershape-property)
237
+
:::
238
+
239
+
## Date and time format specification
240
+
241
+
Pivot uses the following characters for setting the date format:
| %d | day as a number with leading zero | from 01 to 31 |
246
+
| %j | day as a number | from 1 to 31 |
247
+
| %D | short name of the day (abbreviation) | Su Mo Tu Sat |
248
+
| %l | full name of the day | Sunday Monday Tuesday |
249
+
| %W | week as a number with leading zero (with Monday as the first day of the week) | from 01 to 52/53 |
250
+
| %m | month as a number with leading zero | from 01 to 12 |
251
+
| %n | month as a number | from 1 to 12 |
252
+
| %M | short name of the month | Jan Feb Mar |
253
+
| %F | full name of the month | January February March |
254
+
| %y | year as a number, 2 digits | 24 |
255
+
| %Y | year as a number, 4 digits | 2024 |
256
+
| %h | hours 12-format with leading zero | from 01 to 12 |
257
+
| %g | hours 12-format | from 1 to 12 |
258
+
| %H | hours 24-format with leading zero | from 00 to 23 |
259
+
| %G | hours 24-format | from 0 to 23 |
260
+
| %i | minutes with leading zero | from 01 to 59 |
261
+
| %s | seconds with leading zero | from 01 to 59 |
262
+
| %S | milliseconds | 128 |
263
+
| %a | am or pm | am (for time from midnight until noon) and pm (for time from noon until midnight)|
264
+
| %A | AM or PM | AM (for time from midnight until noon) and PM (for time from noon until midnight)|
265
+
| %c | displays date and time in the ISO 8601 date format| 2024-10-04T05:04:09 |
266
+
267
+
268
+
To present the 20th of June, 2024 with the exact time as *2024-09-20 16:47:08.128*, specify "%Y-%m-%d-%H:%i:%s.%u".
269
+
270
+
## Number formatting
271
+
272
+
By default, all fields with the *number** type are localized according to the locale (the value in the `lang` field of the locale). The `Intl.NumberFormat` object enables language-sensitive number formatting. In case you need to disable number formatting of some fields, add the template via the [`tableShape`](/api/config/tableshape-property) property or set the *text* type for this field instead of the *number* type.
0 commit comments