Dates are not transferring on taking attendance

Hello everyone,

When taking attendance under People>Attendance the date is not correct on the destination page.

When I click on the 20 in the bottom row:

I get this page with an odd error message and an incorrect date:

The server time is correct: Fri Apr 20 11:56:27 PDT 2018`

Does anyone have any ideas?

I’m suspicious of your encoding and proxy again, I havn’t seen this behavior elsewhere. What does the resulting URL look like on the second page? Does it happen for any other pages with dates passed in the URL?

It is interesting that it thinks 1969 is in the future :smirk: But of course it’s just falling back to one second before the UNIX epoch so it’s likely a null reference being passed into the expected date value.

@ross I’ve seen in the past with US dates in some cases, but this is all OOified, so it would not make sense that it would be an isolated case.

@fvlasie can you confirm that you have language set to US English?

Terminal reports: LANG=en_US.UTF-8

Is there somewhere else I should check for this?

Thank you!

Oops, I forgot the destination URL:`

Other pages seem to pass the date successfully, such as:`

Maybe something with URL encoding again?

Thanks for clarifying the language setting as US English. That is very odd, and I guess you are right in terms of encoding. Is there any reason you can see why the previous fix might not be working in this case?

The “Take Attendance by Class” feature that is passing the date successfully is a form submit button (Go) such as the one on the page: Home > Attendance > Take Attendance by Class

The other URL is from clicking on the date on the page: Home > Attendance > View Daily Attendance

This difference between form submit and simple link appears to be consistent on other pages too. i.e. form submits get URL encoded (and work), simple links do not get encoded (and do not work).

It does not seem to be a URL encoding issue. The date formats are different between the two URLs: 2018-04-23 vs 04/23/2018

Now that is very interesting, as the date should be transferred in form shown in the text box to the user, not in MySQL style (e.g. YYYY-MM-DD). I see it, with UK English correctly:


And also for US English:


So, it seems like I can’t reproduce the behaviour you are seeing.

Keep digging, we are getting close!

Well it is not a problem with the URL. When I switch to UK English the problem disappears despite the two different URL date formats persisting.

I took a closer look at the code… and I’m going to chime in here and take the blame on this one :sweat_smile: Looks like the Daily Attendance page is passing all the dates for the links as YYYY-MM-DD, and the dateConvert() function has a strtotime() inside it (except for US dates, because they’re wonky and handled separately), so the function was gratiously allowing me to mishandle the dates without knowing it. I think this was one of the earlier things I contributed … either way, I’ll PR a fix.

Can someone tell me what module/code is responsible for parsing the URL date info?
It seems to be upset with converting 2018-04-23 to US format.

That is weird, I guess we posted at the same time!

Thank you, Sandra!

I grew up with “normal” dates. I still get confused from time to time with US dates having the month first!

Ah, right, I forgot that there was another page that forwarded along to here. Next time I’ll have to ask for exact steps to reproduce! The resulting PR has now been merged. Case closed : )