Uncaught TypeError: Cannot read property 'formatDate' of undefined on Event report

Hi community,

I came back again with this question after some week without answer and I am trying to explain it in different words. When I open the event report apps to do analysis on tracked data, most of the time the event report dont show up and when I go to the console I see this message:
app.js:sourcemap:8 DHIS2 event reports app v29.0.39
app.js:sourcemap:13 Uncaught TypeError: Cannot read property ‘formatDate’ of undefined
at Object.D [as WestRegionTrackerItems] (app.js:sourcemap:13)
at g.n [as fn] (app.js:sourcemap:1)
at g.resolve (app.js:sourcemap:8)
at g.ok (app.js:sourcemap:8)
at Object.success (app.js:sourcemap:7)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest. (jquery.min.js:4)

To solve this I have to clear all my browsing data and restart again the browser but even in this case some time it does not work. My DHIS2 version is 2.19 and my chrome browser version is 69.0.3497.100 (Official Build) (64-bit).

Thanks for your assistance.

1 Like

Hi @Gerard, kindly be patient and the team will get back to you on this.

@Emma_Kassy, @Calle_Hedberg, @Scott - Kindly assist Gerard here.

Thanks,
James.

@Gerard_Bisama

Gerard,

Your DHIS version is VERY old/outdated, but it looks like you have some meta-data or configuration errors in the database - very difficult to say where.

Just last week I assisted with upgrading a Dem Rep of Congo database from 2.19/2.20 to 2.30, and for instance I had to really dig into the database itself to identify and fix a problem that caused “Data Integrity” to fail. It turned out to be just one record in the organisationunit table where the default openingdate of 1970-01-01 somehow had been entered into the “featuretype” field. Impossible to say how or why, but identifying and deleting that single whacko value “un-blocked” Data Integrity.

I suspect your problem is similar - some whacko value(s) somewhere, or some incorrect configuration. At least for me, I would need access to a copy of the db to be able to possible track it down. Alternatively, one of the senior developer from the core dev team - if any of them still remember 2.19 ;-o - could “step through” the event report app API calls to see exactly where it fails. (which reminds me: if you look at the tomcat/catalina log messages, they might provide more details than what you can see in the console).

Best regards
Calle

1 Like

Thanks James

1 Like

Thanks Calle,

I will try to browse though my metadata and try to call the event report through API to see I can get anything that can guide me. Otherwise I will ask the system admin to sent me the catalina logs at the point of time to analyse if I can find out anythings.
I will not hesitate to ask again question if needed.

Thanks again,

1 Like

Hello Gerald.
Did you get to sort this error. I have similar error and looking for solution.
Kind regards. Sadik

1 Like

You should use this code This is working
$.datetimepicker.setDateFormatter({
parseDate: function (date, format) {
var d = moment(date, format);
return d.isValid() ? d.toDate() : false;
},
formatDate: function (date, format) {
return moment(date).format(format);
},
});
$(’#datetimepicker’).datetimepicker({
changeYear: true,
changeMonth: true,
minDate: 0,
format: ‘YYYY-MM-DD hh:mm A’,
});

How? Use it where?