Hi
I’ve changed the default locale to en_GB in my app.php and although it is displaying the dates correctly it’s causing me some confusion.
The site is for camping in the uk and allows people to book online. So i have a booking controller and it works well for all the basic CRUD stuff. I can add, edit, view bookings so i know that Cake is handling the dates properly when displaying them and when communicating with the database.
The problem arises when i try to pass response data to another action within the booking controller. There’s a sequence of actions: select-dates, add-details, additional-people. I want each one of these actions to pass the data they gather on to the next action, and i decided to use setAction to do that. I’m quite new to Cakephp so this could just be a massive misconception on my part.
So in the first action of the booking process the users select their dates and submit the form. In the controller action i use patch entity on the response data and pass the result into setAction which loads the next action of the booking process. The dates are passed successfully, but only if i use a two digit year. I’d really like to understand why that is.
When i debug the variable that the second controller sends to the view i can see that any date sent with a four digit year produces the following error: “The value provided is invalid”
I’ve tried changing the validation format for the date fields in the validator for the model but it didn’t help. I’ve read a lot about how to setup date formats but i’m finding it very confusing so i would very much appreciate some advice on this.
Cheers.