Correctly parse the date saved in Course Options > Restrictions > Enrollment Start Date based on WordPress Dashboard > Settings > General > Date Format.
Reproduction Steps
- Refer to reproduction steps in https://github.com/gocodebox/lifterlms/issues/2447.
- Use the date picker to select a date for
Course Options > Restrictions > Enrollment Start Date. Select January 6, 2023. It will enter01/06/2023as the date. - Update the course.
- When you view the course on the front-end, it will not show an error such as
Enrollment in this course opens on 01/06/2023since today is March 29, 2023 and January 6, 2023 has already passed. - Go back to the back-end of the course.
- On
Course Options > Restrictions > Enrollment Start Date, change01/06/2023to06/01/2023(that, switch the month and day values). - When you view the course on the front-end, it will show an error such as
Enrollment in this course opens on 06/01/2023. It thinks of06/01/2023as if it were June 1,2023 when it should be treated as January 6, 2023 since you specified thed\m\Ydate format inWordPress Dashboard > Settings > General > Date Format.
Expected Behavior
It does not correctly parse the date saved in Course Options > Restrictions > Enrollment Start Date based on the date format you specified in WordPress Dashboard > Settings > General > Date Format. In particular, it displays Enrollment in this course opens on ... on the front-end when you try to enter a date in the d/m/Y that could be mistakenly parsed as a future date.
Actual Behavior
It should correctly parse the date saved in Course Options > Restrictions > Enrollment Start Date based on the date format you specified in WordPress Dashboard > Settings > General > Date Format.
This issue has be recreated:
- [x] Locally
- [ ] On a staging site
- [x] On a production website
- [ ] With only LifterLMS and a default theme
I'm closing this issue since this duplicates the issue already described in https://github.com/gocodebox/lifterlms/issues/392. In particular, this is covered by Any dates displayed on frontend should utilize WP default blog settings in https://github.com/gocodebox/lifterlms/issues/392
Reopening to verify. If dates are parsed wrong on in the DB/frontend that's a bigger issue than just fixing the display via #2447