Skip to content

Document and normalize data_api.request_date (and all other arguments) #590

@DiegoPino

Description

@DiegoPino

What?

My bad. By default data_api.request_date is actually Time (H:M:i). Should be the whole date with Time Zone offset.

That is how I coded it. Bad

Work around is

In your OAI Wrapper template instead of

 <responseDate>{{  data_api.request_date }}</responseDate>

Use

{% set response_date = "now"|date("Y-m-d\TH:i:s\Z") %}
{% if data_api.request_date %}
  {% set response_date = "now"|date("Y-m-d") ~ "T" ~ data_api.request_date|render ~ "now"|date("P") %}
{% endif %}
 <responseDate>{{ response_date }}</responseDate>

The real solution is to actually return date("Y-m-d\TH:i:s\Z") from the controller as context which requires for those with custom twig templates manual changes (sorry @alliomeria I hate to do that, but its needed)

Also:

Arguments that contain : are wrongly split. I need a different splitting code (view:display:argument:value:api_argument) logic that splits the first 3, then the rest in reverse, joins what is not the last.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationDrupal 10Upgrade economyDrupal 11Burning fossil fuelOpenAPIa small crack in the matrixTwigTwig template processing

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions