espenmn
(Espen)
September 15, 2020, 2:58pm
1
Is there a smart 'syntax' for pat moment if I have 'full day' ?
The following works OK, but it looks a bit strange for full day, since:
<span class="pat-moment"
data-pat-moment="format:DD.MM YYYY HH:mm;">${item/start}</span>
returns
02.04 2021 00:00
Basically, I just want to skip 00:00
jaroel
(Roel Bruggink)
September 15, 2020, 3:45pm
2
What did you try that didn't work as expected?
espenmn
(Espen)
September 15, 2020, 4:23pm
3
Well, it works as expected, but maybe there is a pat-moment format that skips 'time' when it is '00:00' or maybe a tal condition could be used.
zopyx
(Andreas Jung)
September 15, 2020, 7:28pm
4
Does not make sense what your are asking.
If you specify a time format, the time will be displayed. Write custom code if you need this very special requirement done.
zopyx
(Andreas Jung)
September 15, 2020, 7:29pm
5
Or use tal:attributes to generate the data attribute with an inline if-else condition.
espenmn
(Espen)
September 16, 2020, 8:54am
6
Did not find any 'sane tal conditions' and, so I ended up adding 'whole_day' to indexes.
zopyx
(Andreas Jung)
September 16, 2020, 11:08am
7
Why is something like
tal:attributes="data-pat-moment python: 'format:DD.MM YYYY HH:mm' if some_condition else 'format:DD.MM YYYY' "
not working for you?
some_condition
is an expression for `item.start that would check for the hours + minutes being zero...or something similar...
espenmn
(Espen)
September 16, 2020, 11:57am
8
I have no problems with putting a conditions on it, in fact that is what I asked for before you answered the first time.
Finding out what the difference with something starting at 00:00 (midnight (?)) or 'being a full day' was confusing , so I added an index and used condition
item.whole_day == "False"
showing
data-pat-moment="format:DD.MM.YYYY">
and True
data-pat-moment="format:DD.MM.YYYY - HH:mm;">
Since it is also possible to have "open end" and have start and end on different days I am not sure what 'math to use in a condition'