JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › datePicker error in grid
Tagged: datetimepicker editor
- This topic has 24 replies, 3 voices, and was last updated 2 years, 7 months ago by tbettinazzi@axioma.it.
-
AuthorPosts
-
March 28, 2022 at 6:47 am #103005adminKeymaster
Hi,
We are unable to reproduce it with the latest version. Please, check whether you use the most-recent files and clear your web browser’s cache.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 29, 2022 at 4:44 pm #103019tbettinazzi@axioma.itParticipantSorry I was forced to change the account because I don’t receive mails anymore on the other account.
Anyway I still find the problem.
I suspect the problem coud be my PC language setting which is Italian.
When I open the date picker I see all in english.
Is there any specific setting for the datekeeper related to language ?
Tks
March 30, 2022 at 7:34 am #103023adminKeymasterHi,
Only locale which defaults to ‘en’.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 30, 2022 at 8:08 am #103024tbettinazzi@axioma.itParticipantMy browser locale is it_IT and is correct but the datepicker still shows english captions and seems to work in american standard.
Tks
I got the browser language using
function getLang() {
if (navigator.languages != undefined)
return navigator.languages[0];
return navigator.language;
}March 30, 2022 at 8:12 am #103025adminKeymasterHi,
locale is a property. If you do not set it, it is not set automatically. The DateInput works with the settings set by the user. Otherwise, it uses default settings.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 30, 2022 at 8:57 am #103026tbettinazzi@axioma.itParticipantSorry but I still don’t understand where and how to set locale.
I use :
{ label: ‘Campo data 1’, dataField: ‘C6’, cellsFormat: ‘dd/MM/yyyy’,
editor: {
template: ‘dateTimePicker’,
formatString: ‘dd/MM/yyyy’,
onInit(index, dataField, editor) {}}},but I don’t understand where set my locale.
Tks
March 30, 2022 at 1:06 pm #103027adminKeymasterHi,
Actually, here the issue is different. The data which comes from your data source is String, not a Date object so the format here is ambiguous. From new Date(“01/06/1954”) it will create 6 January 1954. If you pass a Date object instead of String in your data source it will work. In the next version, the dataField will include a formatString property in order to enable deserialization of string dates in the specific formats i.e you will be able to set it like that
` dataSource: new Smart.DataAdapter({
dataSource: [{
“C1”: “1”,
“C2”: “Hot Chocolate”,
“C4””: “SEAVISION”,
“C6”: “01/06/1954”,
“C5”: “true”,
“C3”: “14g”
}],
dataFields:
[{ name: ‘C1’, dataType: ‘number’ },
{ name: ‘C2’, dataType: ‘string’ },
{ name: ‘C4’, dataType: ‘string’ },
{ name: ‘C5’, dataType: ‘bool’ },
{ name: ‘C3’, dataType: ‘string’ },
{ name: ‘C6’, dataType: ‘date’, formatString: ‘dd/MM/yyyy’ }
]
})`Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 31, 2022 at 1:28 pm #103032tbettinazzi@axioma.itParticipantTks but I still don’t understand how to “pass a date” in a json datasource.
Could You suggest the correct way ?
Tks
March 31, 2022 at 1:51 pm #103033adminKeymasterSimply try C6: “2016-06-23T09:07:21-07:00” as a date string.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 31, 2022 at 2:17 pm #103034tbettinazzi@axioma.itParticipantTks, it seems to work.
How can I force the calendar to appear in italian and not in english ?
Tks
-
AuthorPosts
- You must be logged in to reply to this topic.