Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a date variable for templates in ISO 8601 format #1315

Open
dstengle opened this issue Dec 28, 2023 · 2 comments
Open

Add a date variable for templates in ISO 8601 format #1315

dstengle opened this issue Dec 28, 2023 · 2 comments
Milestone

Comments

@dstengle
Copy link

Is your feature request related to a problem? Please describe.

I made my own "created" forematter item in my templates and just discovered it is wrong and now I have hundreds of files with incorrectly formatted datetime entries.

Describe the solution you'd like

As a user that is creating a template, I would like to have a variable available with the ISO8601 datetime as described here https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations so that I do not have to figure out the correct format myself.

Describe alternatives you've considered

I made the format manually in my templates and have a misplaced ":" that breaks correct parsing in other software.

Screenshots or Videos

No response

@dstengle
Copy link
Author

Just found out it was even more screwed up because my templates had a unicode HYPHEN (\u2010) instead of HYPHEN-MINUS (\u002d) which I must of copy-pasted from somewhere.

@riccardoferretti
Copy link
Collaborator

Good point, the easy solution here is to just add a FOAM_DATE_ISO variable which returns the Foam date in ISO format (see variable-resolver.ts).

At some point I have been thinking of adding a more powerful templating engine, basically something that can run JS so that there is more flexibility around templates, but I haven't thought through it yet.

@riccardoferretti riccardoferretti added this to the backlog milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants