-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
[Panel] Using num: date in blueprint results in error if date format is set to strftime #1882
Comments
I just ran into this issue. I tracked it down to this commit. Because the For anyone in need of a quick fix you can add following plugin. It's not ideal but at least you can get it working again this way. <?php
// plugins/datefix/index.php
Kirby::plugin('datefix/datefix', [
'fieldMethods' => [
'toDate' => function ($field, string $format = null, string $fallback = null) {
if (empty($field->value) === true && $fallback === null) {
return null;
}
$time = empty($field->value) === true ? strtotime($fallback) : $field->toTimestamp();
if ($format === null) {
return $time;
}
if (option('date.handler') === 'strftime') {
switch ($format) {
case 'Ymd':
$format = '%Y%m%d';
break;
case 'YmdHi':
$format = '%Y%m%d%H%M';
break;
}
}
return option('date.handler', 'date')($format, $time);
},
]
]); |
distantnative
pushed a commit
that referenced
this issue
Aug 8, 2019
This was referenced Aug 8, 2019
bastianallgeier
pushed a commit
that referenced
this issue
Aug 8, 2019
✅ |
bastianallgeier
pushed a commit
that referenced
this issue
Sep 3, 2019
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If you set
for page sorting with the date handler set to strtime in the
config.php
file, the Panel throws an error:This does only happen with the short form, when using the query language with the correct date format for
strftime
, all is well.To Reproduce
Steps to reproduce the behavior:
strfttime
Expected behavior
Don't know if this is a bug. Maybe the short form could also respect the date format. If not, we have to add a note in the docs.
Kirby Version
3.2
The text was updated successfully, but these errors were encountered: