Skip to content

DateTime hardcoded format Y-m-d H:i:s drives to "Error converting data type varchar to datetime" #608

Closed
@mikeabbott10

Description

@mikeabbott10

PHP Version

8.1

CodeIgniter4 Version

4.3

Shield Version

1.0.0-beta3

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

SQL Server 2019

Did you customize Shield?

No

What happened?

My db language is Italian and expects datetime format like 'd-m-Y H:i:s'. When you attempt to login, it tries to insert a row using the format 'Y-m-d H:i:s' by default and that's hardcoded at Shield\Models\LoginModel row 71.

'date' => Time::now()->format('Y-m-d H:i:s'),

Steps to Reproduce

Connect to a database with a datetime expected format not equal to 'Y-m-d H:i:s' and try to login

Expected Output

The row gets insterted

Anything else?

I think the format has to be customizable without the need to extend the LoginModel and override the whole recordLoginAttempt just for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions