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

Issue with date_to_rfc822 filter #3298

Closed
ryanburnette opened this Issue Jan 13, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@ryanburnette
Contributor

ryanburnette commented Jan 13, 2015

I'm using Jekyll 2.5.1 and I'm using Collections pretty heavily. In each item in a particular collection I have a date field in my YAML front-matter. In one of my templates I filter that date using the date_to_rfc822 Liquid filter.

The YAML front-matter item looks like this

date: 2014-12-07

The template item looks like this

{{ item.date | date_to_rfc822 }}

And this is the error I get.

Invalid Date: '2014-12-07' is not a valid datetime.

Looking at the source of this filter it looks like it's falling through the case statement.

Note that if I set the date like this it works fine.

date: "2014-12-07"
@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 13, 2015

Member

What is the type of the first option?

Member

parkr commented Jan 13, 2015

What is the type of the first option?

@ryanburnette

This comment has been minimized.

Show comment
Hide comment
@ryanburnette

ryanburnette Jan 13, 2015

Contributor

I don't know. I was about to test that and I just had to jump on the phone for a bit. Great question. It should be a String I thought.

Contributor

ryanburnette commented Jan 13, 2015

I don't know. I was about to test that and I just had to jump on the phone for a bit. Great question. It should be a String I thought.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 13, 2015

Member

This is probably a bug:

>> yaml = "date: \"2014-12-07\"\ndate_other: 2014-12-07"
=> "date: \"2014-12-07\"\ndate_other: 2014-12-07"
>> SafeYAML.load(yaml)
=> {"date"=>"2014-12-07", "date_other"=>#<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>}
>> SafeYAML.load(yaml).map(&:inspect)
=> ["[\"date\", \"2014-12-07\"]", "[\"date_other\", #<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>]"]

We accept Time elements, but not Date ones.

Member

parkr commented Jan 13, 2015

This is probably a bug:

>> yaml = "date: \"2014-12-07\"\ndate_other: 2014-12-07"
=> "date: \"2014-12-07\"\ndate_other: 2014-12-07"
>> SafeYAML.load(yaml)
=> {"date"=>"2014-12-07", "date_other"=>#<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>}
>> SafeYAML.load(yaml).map(&:inspect)
=> ["[\"date\", \"2014-12-07\"]", "[\"date_other\", #<Date: 2014-12-07 ((2456999j,0s,0n),+0s,2299161j)>]"]

We accept Time elements, but not Date ones.

ryanburnette added a commit to ryanburnette/jekyll that referenced this issue Jan 13, 2015

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.