jaredcowing / wmsNewBooks

Small program to view list of new books by fund & date acquired using WorldShare Acquisitions API.
MIT License
2 stars 1 forks source link

orderDate formating #7

Closed gjerdery closed 3 years ago

gjerdery commented 4 years ago

Line 228 of Bookfeed.php sets the orderDate database field to the format of "Y:m:d". However, the viewFAS() function in Bookview.php wants to pass the $dateCutoff parameter to Newbooks_model->loadList2 in the format of "Y-m-d". In my case, the difference in date facet separators was causing the loadList2 function to return unexpected results. I've addressed this by converting the $dateCutoff string into a datetime variable, and then reformatting as "Y:m:d", as such: https://github.com/gjerdery/wmsNewBooks/commit/1ef4a88d7ae9eb8820a60780a04f2c196cea2d2f

A question would be, should Bookfeed.php just save the date in the "Y-m-d" format to begin with?

jaredcowing commented 4 years ago

Interesting, my MySQL database was storing those dates with dashes anyway so I never saw the potential problem with search results. You're right, the better approach would be to use "Y-m-d" from the beginning in Bookfeed.php. I'll give that a try and update the repository assuming it works as intended.

jaredcowing commented 3 years ago

Fix added to the repository, if that doesn't fix the problem let me know.