![]() |
Just to help out anyone who might be having trouble with their date formats: Once I got past my confusion, as mentioned above, it turned out that I did still have a date format issue. What it comes down to is that if your database is configured in such a way that it won't accept a datetime in the format Y-m-d H:i
![]() ![]() In order to override these methods, you can create a UserModel in your app directory that extends Shield's UserModel (class UserModel extends \CodeIgniter\Shield\Models\UserModel) containing only the 'timeToDate' and 'intToDate' methods, using whatever date formats you need. You'll also want to include Shield's 'updateActiveDate' method to use the same custom date format. Since this model will only contain these 3 methods, it's no big deal to set your custom date format into each one, but for a more elegant solution you can set your date format into a config file and have your 3 methods reference that, so you'd only have to specify it once. Then go to App/Controllers/AuthController.php and replace 'use CodeIgniter\Shield\Models\UserModel;' with 'use App\Models\UserModel;' This will override the three methods mentioned above, preserving everything else as is. This approach saves you from having to change any files in your vendor folder, which you want to avoid because such changes would be lost when you do a Composer update. This has enabled me to register new users without hitting the date format error. I don't know if there are other instances in Shield that will run into this date format problem, but I assume they could be fixed by continuing along the lines of the above approach. |
Messages In This Thread |
Shield with Oracle - get date format error - by [email protected] - 11-13-2023, 09:16 AM
RE: Shield with Oracle - get date format error - by kenjis - 11-14-2023, 01:04 AM
RE: Shield with Oracle - get date format error - by [email protected] - 11-14-2023, 07:47 AM
RE: Shield with Oracle - get date format error - by [email protected] - 11-15-2023, 03:26 PM
|