Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Conversation

@thoemmi
Copy link
Contributor

@thoemmi thoemmi commented Jul 1, 2015

Currently the handling of page.date is inconsistent:

  1. If there's no date specified in a page's front-matter but is extracted from the filename, page.Bag["date"] is a DateTime
  2. If there's a date specified in a page's front-matter, page.Bag["date"] is a string (as parsed by YamlDotNet)

When you're using {{ page.date | date_to_xmlschema }} on your template, and page.Bag["date"] is a string, it will be rendered as Liquid error: Object of type 'System.String' cannot be converted to type 'System.DateTime'.

This PR fixes this by always adding the date back to page.Bag["date"] as DateTime (in fact I only had to delete some code in SiteContextGenerator.cs. 😉) Two other tests relied on strings, which I fixed.

@laedit
Copy link
Contributor

laedit commented Aug 4, 2015

Excellent, thanks a lot!

laedit pushed a commit that referenced this pull request Aug 4, 2015
Inconsistent page.date handling
@laedit laedit merged commit 164cf66 into Code52:master Aug 4, 2015
@thoemmi thoemmi deleted the page-date-handling branch August 4, 2015 05:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants