Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom timestamp format #13

Merged
merged 1 commit into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static function register(array $credentials, array $uniques = [])
}

if (static::$settings['USE_TIMESTAMPS']) {
$now = (new \Leaf\Date())->tick()->now();
$now = (new \Leaf\Date())->tick()->format(static::$settings['TIMESTAMP_FORMAT']);
$credentials['created_at'] = $now;
$credentials['updated_at'] = $now;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public static function update(array $credentials, array $uniques = [])
}

if (static::$settings['USE_TIMESTAMPS']) {
$credentials['updated_at'] = (new \Leaf\Date())->tick()->now();
$credentials['updated_at'] = (new \Leaf\Date())->tick()->format(static::$settings['TIMESTAMP_FORMAT']);
}

if (count($uniques) > 0) {
Expand Down
1 change: 1 addition & 0 deletions src/Auth/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Core
'DB_TABLE' => 'users',
'AUTH_NO_PASS' => false,
'USE_TIMESTAMPS' => true,
'TIMESTAMP_FORMAT' => 'c',
'PASSWORD_ENCODE' => null,
'PASSWORD_VERIFY' => null,
'PASSWORD_KEY' => 'password',
Expand Down