I am getting ‘2022’ on all toDate(‘Y’) calls. This is my blueprint:
datestart:
label: Date
type: number
ongoing:
label: Ongoing ?
type: toggle
text:
- "no"
- "yes"
dateend:
label: End date
type: number
when:
ongoing: false
This is a content file example
Datestart: 2020
----
Ongoing: false
----
Dateend: 2021
This is my template code :
<div class="content-work-date">
<?= $work->datestart()->isNotEmpty() ? $work->datestart()->toDate('Y') : 'n.d.'?>
<?= $work->ongoing()->toBool() ? ' - ongoing' : '' ?>
<?= $work->dateend()->isNotEmpty() ? ' - ' . $work->dateend()->toDate('Y') : '' ?>
</div>
And this is output
2022 - 2022
It looks as if I was doing the typical mistake of calling my date field “date”, and so actually making a new date in the process instead of retrieving that in the field. But I can’t see how am I doing this.
Possibly a stupid mistake, apologies in advance.
Thank you