Our app is fully localized/globalized, supporting (some of the few) en-US and de-DE.
In our DB, some of the currency values are stored in USD, some of the currency values are stored as Euros. Obviously, we want to keep the currency straight between the two - formatting as USD, when in fact it is Euros, would be a big mistake.
So, following this example, we can format for USD/Euros, given the proper locale.
My issue is: Given data (12345.67) in the DB in Euros and the user logged into the en-US locale, I want to have the Euro symbol show up properly (including location of symbol relative to numeric value) and the commas/decimals to be proper as well (i.e. 12,345.67 €). And the reverse, given data (98765.43) in the DB in USD and the user logged into de-DE, I want to have the USD symbol show up and the commas/decimals to be proper as well (i.e. $ 98.765,43).
How can I achieve this?
Thanks,
--Ed
It seems to me that kendo has all the bricks to handle timezones without requiring momentJS or any other comparable library, but I cannot relally figure out how to use it.
this
.$(
'.kendoHourInput'
).kendoNumericTextBox({
format:
'#.0 h'
});
Uncaught TypeError: Cannot read property
'numberFormat'
of
null
shim: {
...
someLib: {
deps: [
'globalize'
]
}
}
$(
"#grid"
).kendoGrid({
dataSource:{
data:[
{
utcdate: kendo.parseDate(
"2012-04-18 11:23:45Z"
,
"u"
),
localdate:
new
Date()
}
],
schema:{
model:{
fields:{
utcdate:{
type:
"date"
},
localdate:{
type:
"date"
}
}
}
}
},
height:360,
groupable:
true
,
scrollable:
true
,
sortable:
true
,
pageable:
true
,
columns:[
{
field:
"utcdate"
,
title:
"local from UTC"
,
format:
"{0:yyyy-MM-dd HH:mm:ss}"
,
width: 150
},
{
field:
"utcdate"
,
title:
"UTC from UTC"
,
format:
"{0:u}"
,
width: 150
},
{
field:
"utcdate"
,
title:
"UTC-S from UTC"
,
format:
"{0:s}"
,
width: 150
},
{
field:
"localdate"
,
title:
"local from local"
,
format:
"{0:yyyy-MM-dd HH:mm:ss}"
,
width: 150
},
{
field:
"localdate"
,
title:
"UTC from local"
,
format:
"{0:u}"
,
width: 150
},
{
field:
"localdate"
,
title:
"UTC-S from local"
,
format:
"{0:s}"
,
width: 150
}
]
});
Looking at the Kendo UI source code for parsing dates, it clearly does not have a check for the "Z" timezone marker. And is also missing a UTC() function call to create the date. The formatting functions also don't use the JavaScript Date UTC functions.
Can this be fixed globally somehow?
Best Regards,
Wannes.