-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
"Invalid Date" parsing dates in pages section with layout:table #6230
Comments
I can reproduce the issue on 4.1.0 either. Works great for 4.0.3 |
@distantnative Yes |
I think also following usage give outputs same with columns:
date:
display: DD.MM.YYYY |
Bug still exists ([email protected]) when day ist < 10 in For the first cell "Date Start" data is However, it is still fixable with Please reopen @distantnative |
@janstuemmel What's your blueprint? |
Works with # events.yml
title: Events
tabs:
events:
label: Events
columns:
- width: 2/3
sections:
events:
extends: sections/events
query: page.children.sortBy("dateStart", "asc").filterBy("dateEnd", "date >=", "today")
# ... # sections/events.yml
label: Events
type: pages
template: event
limit: 10
sortable: false
status: published
layout: table
search: true
columns:
dateStart:
label: Datum Start
# type: text # <- fixes display of date
value: "{{ page.dateStart.toDate('dd.MM.Y') }}"
width: 1/7
dateEnd:
label: Datum Ende
# type: text # <- fixes display of date
value: "{{ page.dateEnd.toDate('dd.MM.YY') }}"
width: 1/7 <?php
return [
'date.handler' => 'intl',
'locale' => 'de_DE.UTF-8',
// ...
]; |
And your event.yml? |
# pages/event.yml
title: Event
create:
slug: "{{ page.dateStart.toDate('Y-m-d') }}-{{ page.title.slug }}"
fields:
- dateStart
- dateEnd
redirect: false
status: draft
status:
draft: false
listed: true
sort: false
columns:
# ...
- fields:
dateStart:
type: date
label: Datum Start
display: DD.MM.YYYY
required: true
dateEnd:
type: date
label: Datum Ende
display: DD.MM.YYYY
required: true Example event content:
|
So your field is defining the display as |
Like this? # sections/events.yml
label: Events
type: pages
template: event
limit: 10
sortable: false
status: published
layout: table
search: true
columns:
dateStart:
label: Datum Start
# type: text # <- fixes display of date
# value: "{{ page.dateStart.toDate('dd.MM.Y') }}"
display: dd.mm.Y
width: 1/7
dateEnd:
label: Datum Ende
# type: text # <- fixes display of date
value: "{{ page.dateEnd.toDate('dd.MM.YY') }}"
width: 1/7 That leads to a empty "Date Start" column. And it makes sense, since value is undefined What works though is: columns:
dateStart:
label: Datum Start
# type: text
value: "{{ page.dateStart }}"
display: DD.MM.YY
width: 1/7 |
Is it now still a bug or expected behaviour? I would have assumed that table columns take exactly what's defined in my content txt files. Is the |
Can you please answer my question? |
@janstuemmel I figured it out: it's an issue of case matching: #6473 Once I write |
Thank you |
Description
In the pages section, when using
layout:table
with custom columns, the date parsing shows "Invalid Date" for days > 12 and don't format as expected for days <= 12. Using date handlerintl
.Expected behavior
Date: 2023-11-24 16:00:00
.toDate('dd.MM.Y') should be 24.11.2023 (is "Invalid Date")Date: 2021-10-05 00:00:00
.toDate('dd.MM.Y') should be 05.10.2021 (is "2021-05-10")Screenshots
To reproduce
intl
date handler to config.phplayout:table
withcolumns: / date: / value: "{{ page.date.toDate('dd.MM.Y') }}
to blueprints/sections/notes.ymlYour setup
Kirby 4.1.0 (no problems with Kirby 4.0.3)
The text was updated successfully, but these errors were encountered: