Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker issues in default theme. #1126

Merged
merged 1 commit into from
Jun 4, 2013
Merged

Datepicker issues in default theme. #1126

merged 1 commit into from
Jun 4, 2013

Conversation

solarissmoke
Copy link
Contributor

Ran into a few issues with the datepicker in the reports view of the default theme. It uses the US standard date format (mm/dd/yyyy), and if the PHP locale is different, then the date query will be parsed differently by the server (e.g., 01/05/2013 will be parsed as 1st May 2013 and not 5th January 2013).

Also the "this week" quicklink breaks when the week crosses into the next month.

I haven't looked at the other bundled themes, but this may apply to them as well?

- Don't use mm/dd/yyyy format as this will be parsed inconsistently by PHP's
strtotime() depending on locale settings. Use ISO date format instead.

- Make sure the "This Week" quicklink works even if the week crosses into
  the following month.
@rjmackay
Copy link
Contributor

Is this impacted at all by the browsers locale too?
I tried to fix some of the issues with this in the 2.7 release but clearly didn't get them all.

@solarissmoke
Copy link
Contributor Author

I don't think so - the following line:

date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat )

... uses datepicker's default format which is also mm/dd/yyyy (so there is no client-side localisation). The only issue is that PHP will not parse this format consistently.

@rjmackay
Copy link
Contributor

rjmackay commented Jun 4, 2013

Merging this in.

rjmackay added a commit that referenced this pull request Jun 4, 2013
Datepicker issues in default theme.
@rjmackay rjmackay merged commit 1a195b4 into ushahidi:develop Jun 4, 2013
@rjmackay
Copy link
Contributor

rjmackay commented Jun 4, 2013

Also note: this should fix other themes too since they don't override reports_js they just inherit it.

@solarissmoke
Copy link
Contributor Author

Hmm there are still some issues here. Apparently the yyyy in the new format causes the datepicker to insert the four-digit year twice :S. It needs to be changed to yy-mm-dd.

Also if you select "all time" then the title displays: "Showing Reports From to". Also the format displayed in the title changes when you select a date range. Neither affects functionality but they do look a bit weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants