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

SirsiDynix: Additional Datepicker fixes #619

Merged
merged 7 commits into from
Dec 11, 2019

Conversation

queryluke
Copy link
Contributor

This is an extension of #581 and #582

Prior to this fix, dates within a form are formatted by the datepicker plugin. Thus, in the config file, if the format were dd/mm/yyyy, the date January 2nd, 2019 would be formatted and submitted as the string 02/01/2019.

But the php scripts that parse the $_POST variables are using strtotime(), which "..expects to be given a string containing an English date format". Further digging into php docs showed that strtotime only works with American date formatting when using forward slashes, and has very specific formats for dashes.

Thus the above string of 02/01/2019 will always be parsed as February 1st, 2019 using strtotime()

Here, I've written the necessary functions to use date_create_from_format(), which, instead, lets you pass a specific format to the parser, so the parse knows exactly where days and months exist in the string.

Testing

  1. In common/configuration.ini Change the datepicker_date_format and date_format settings to something else (e.g. dd-mm-yyyy and %d-%m-%Y, respectively).
  2. Create a new resource
  3. Edit the resource's order (or add a new one) and change the subscription start-end dates.
  4. The dates entered in the form should persist after the order information is submitted (prior to this fix, a data such as 20-12-2019 would have resulted in a 1969 date because strtotime cannot parse that string.

@andyp-uk
Copy link
Contributor

Fix looks good. We are now able to use dd/mm/yyyy format for display and input, if configured.

In testing, we notice the date format used by CORAL does not respect the values configured in the common/configuration.ini file in the following places. However, these all use the international format (yyyy-mm-dd) and therefore are not likely to be misinterpreted. I didn't want to change them without further discussion.

  • Resources module — Resource record — Order drop-down list (appears when you have two or more orders)
  • Resources module — Resource record — Issues tab — under "view open issues"
  • Usage Statistics module — SUSHI page — on the dialog box after clicking "run now"
  • Management module — Home page — Last Document Revision

@andyp-uk andyp-uk merged commit 987fae6 into coral-erm:development Dec 11, 2019
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