Skip to content

Date no longer allowed in substitutions #747

@tmpethick

Description

@tmpethick

Describe the bug

I am trying to format a date using Jinja2 by adding it using substitutions, but it seems like datetime objects are no longer supported consistently throughout MyST.

I thought I might make you aware of this – thanks for a nice package!

Reproduce the bug

---
myst:
 substitutions:
   date: 2020-02-02
---

{{ date.strftime("%b %d, %Y") }}

This worked in a prior version but now I get the following error:

'substitutions['date']' must be of type (<class 'str'>, <class 'int'>, <class 'float'>) (got datetime.date(2020, 2, 2) that is a <class 'datetime.date'>). [myst.topmatter]

List your environment

❯❯❯ jupyter-book --version 
Jupyter Book      : 0.15.0
External ToC      : 0.3.1
MyST-Parser       : 0.18.1
MyST-NB           : 0.17.1
Sphinx Book Theme : 1.0.0
Jupyter-Cache     : 0.5.0
NbClient          : 0.5.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions