Render Date and formatter
Render Date and formatter
How can I be rendering the date and formatting at the same time because the days under 10 are only 1 digit?
"DataReceive": {
"Year": 2016,
"Month": "DECEMBER",
"DayOfMonth": 8,
"DayOfWeek": "THURSDAY",
"Was": "CE",
"DayOfYear": 343,
"LeapYear": true,
"MonthValue": 12,
Chronology
"Id": "ISO",
"CalendarType": "iso8601"
}
}
My json:
{
"iTotalRecords" : 0,
"iTotalDisplayRecords" : 0,
"data" : [ {
"id" : 1,
"descricaoReceita" : "Entrada 1",
"dataReceita" : {
"year" : 2016,
"month" : "DECEMBER",
"dayOfMonth" : 8,
"dayOfWeek" : "THURSDAY",
"era" : "CE",
"dayOfYear" : 343,
"leapYear" : true,
"monthValue" : 12,
"chronology" : {
"id" : "ISO",
"calendarType" : "iso8601"
}
},
"valorReceita" : 5000.00,
"receitaFixa" : true,
"receitaFixaQuantidade" : 1,
"receitaFixaTempo" : "SEMANAS",
"repetirLancReceita" : false,
"repetirPorPeriodo" : null,
"pagamento" : true,
"addObservacao" : "",
"minhasContas" : [ {
"id" : 5,
"nome" : "Banco D",
"saldoAnterior" : 0.00,
"saldoAtual" : 13012.00,
"saldoFinal" : 16000.00,
"cor" : "#568689",
"dashBoard" : true
} ]
}}
This question has accepted answers - jump to:
Answers
I managed to do it this way, but I still need internationalization to en:
{
Data: "dataReceive",
MRender: function (data) {
DataDay = data.dayOfMonth;
DataObj = data.dayOfMonth + '/' + data.monthValue + '/' + data.year
Return (dataDay <10)? '0' + dataObj: dataObj;
},
}
I'm afraid I don't really understand the second point (internationalisation). Do you want to show the month name? If so, implement a lookup function or use MomentJS to do it for you.
Allan
I want to show the name of the month in portuguese pt-br
Use a simple lookup function or MomentJS in that case.
Allan