grav
grav copied to clipboard
Admin custom datetime doesn't get saved
When editing custom header with datetime type it gets saved only when it was blank. When there is a value saved in page .md file it doesn't save again date and time selected with timepicker. It works fine when changed in Expert mode in md file or directly in default.md file. Is it because it's default or there is any other problem? My blueprint default.yaml file:
title: Page Content
@extends:
type: default
context: blueprints://pages
form:
fields:
tabs:
type: tabs
active: 1
fields:
content:
type: tab
fields:
header.taxonomy:
type: taxonomy
label: tags
multiple: true
validate:
type: array
header.date:
type: datetime
label: Reserved
toggleable: true
help: Please select how long the advert is reserved for.
Steps to reproduce:
- Add custom header with datetime in blueprints
- Edit and save it in admin / page
- Try editing and saving again - doesn't change on save - gets back to old value
I've just come across what I believe is a related datetime issue. If I add this to my page blueprint:
header.releasedate:
type: datetime
label: Release Year
I can pick and save datetimes fine. But if I add the format field:
header.releasedate:
type: datetime
label: Release Date
format: "Y"
Then I start getting display glitches - it can save the year to the page.md file but some years display in the admin panel as 1969 while others are ok. If I adjust the format to other options like "jS M Y" I get glitches like "7o Aug 2007". So far the only options that work correctly are to leave the format field out, or to modify it to "M Y".
You need a year field, I think it may actually exist. Datetime needs at least the full date in order to work.
Mmm. I’m having this issue as well. I could not find a year
field in the list and the fields documentation says datetime
supports format
.
It should be easy to create the field yourself.