on 04-03-2019 10:12 AM
Hi everyone,
i'm using sapui5 version 1.52.
i'm facing the following issue when using vizframe :
graph type is timeseries_stacked_column
i'm using a local model containing for example :
{
"Detail": [{
"Offre": "AssureEnergie",
"Semaine": "Semaine 5",
"Day": "29/03/2019",
"Nombre": 0
}, {
"Offre": "AssureEnergie",
"Semaine": "Semaine 5",
"Day": "28/03/2019",
"Nombre": 0
}, {
in order to display correctly date in the graph, here is my field in the xlm view :
<viz.data:DimensionDefinition name="Day" value="{path: 'ModelData>Day', formatter: '.formatDate'}" displayValue="{path: 'ModelData>Day', Formatter: '.formatDate'}" dataType="date"/>
in the controller, function formatDate is like this :
formatDate: function (val) {
if (val) {
jQuery.sap.require("sap.ui.core.format.DateFormat");
var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({
source: {
pattern: "dd/MM/yyyy"
},
pattern: "yyyy-MM-dd HH:mm:ss"
});
return oDateFormat.format(new Date(val));
}
}
but something is wrong. if I use the code like this, 01/03 and 02/03 are displayed wrong :
instead it display 03/01 and 03/02.
I figured out that treatment seems to treat date like american ones that is to say MM/dd/yyyy instead of dd/MM/yyyy.
that's why I tried another pattern for output :
yyyy-MM-dd HH:mm:ss
this time, 01/03 and 02/03 are correct... but now after 12/03 it doesn't work... probably due to the same format as 13/03 is interpreted as 03/13 instead and [50061] - Le format de certaines dates n'est pas correct message is displayed...
is there a way to work with dd/MM/yyyy easily ? if not I've two other possibilities :
- modifying my file to use american dates as input
- modifying my file to simulate return from odata service and then using ms date/time format like \/Date(1550188800000)\/
what do you think ?
Hello,
One simple way to verify the date is to implement new Date("28/03/2019"). This is a generic function to browser. If it returns invalid, vizFrame would not be able to plot the date.
There are various of Date valid format. For example 2019/03/28, 2019-03-28, 1553702400000 etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.