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

Yaml and Markdown yaml front matter doesn't like single digit months or days #19960

Closed
Tracked by #1
Tyriar opened this issue Feb 5, 2017 · 2 comments
Closed
Tracked by #1
Assignees
Labels
*as-designed Described behavior is as designed bug Issue identified by VS Code Team member as probable bug languages-basic Basic language support issues markdown Markdown support issues

Comments

@Tyriar
Copy link
Member

Tyriar commented Feb 5, 2017

According to the YAML spec http://yaml.org/type/timestamp.html, single digits are allowed:

-[0-9][0-9]? # (month)
-[0-9][0-9]? # (day)

Note this applies to both the front matter section at the top of a markdown file (as below) and in a .yml file

Test text:

---
date1 : 2016-8-2
date1 : 2016-8-20
date1 : 2016-08-2
date1 : 2016-08-20
date2 : 2016-11-20
---

image

image

image

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug languages-basic Basic language support issues markdown Markdown support issues labels Feb 5, 2017
@mjbvz mjbvz added the *as-designed Described behavior is as designed label Feb 6, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Feb 6, 2017

I think this is by design. The yaml timestamp spec is weird in this case. Iit looks like single digit months and years are only supported in full timestemp literals that include times:

 [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] # (ymd)
|[0-9][0-9][0-9][0-9] # (year)
 -[0-9][0-9]? # (month)
 -[0-9][0-9]? # (day)
 ([Tt]|[ \t]+)[0-9][0-9]? # (hour)
 :[0-9][0-9] # (minute)
 :[0-9][0-9] # (second)
 (\.[0-9]*)? # (fraction)
 (([ \t]*)Z|[-+][0-9][0-9]?(:[0-9][0-9])?)? # (time zone)

In the first ymd option, you have to use two digits for months and days. I've checked a few yaml validators and they seem to be consistent in parsing 2016-8-2 as a string instead of as a date

@mjbvz mjbvz closed this as completed Feb 6, 2017
@Tyriar
Copy link
Member Author

Tyriar commented Feb 6, 2017

Ah you're right, I didn't look thoroughly enough and thought the opening paren on the hour line ended at the end. 👍

I guess I'll just use double digits then 😉

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed bug Issue identified by VS Code Team member as probable bug languages-basic Basic language support issues markdown Markdown support issues
Projects
None yet
Development

No branches or pull requests

2 participants