Problem/Motivation
This is a workaround for a limitation of Canvas.
Ideally, the date prop of the hero-blog component would accept a simple Y-m-d string. Unfortunately, when you're mapping a timestamp field (like created) into that prop, all you've got is a timestamp.
Canvas has a way to convert prop values (adapters) but they're not yet supported and they won't be in time for 1.0. Trying to use them will result in a crashing UI in some situations.
So we have to map the timestamp directly into the prop. Unfortunately, Twig has no way to convert a timestamp to a formatted date because it passes raw date values into strtotime(), so we'll have to implement a pre-render callback that converts this prop, if it is an integer, to a Y-m-d value that can be passed to Twig's date filter.
Issue fork mercury-3547303
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
phenaproximaMerged with @galactus86's blessing in Slack.