Skip to content

Jekyll: unquoted dates in frontmatter cause a crash #511

@markstos

Description

@markstos

In frontmatter, dates can be quoted as strings, or unquoted.

The Jekyll migration tool works for the case when the date is quoted, but it has no test coverage for unquoted dates and crashes in that case.

The difference is that the front-matter library will parse the date directly into a date object if it's not quoted. Because the importing code only expects strings, it fails like this:

 TypeError: frontmatterAttributes.date.match is not a function

To trigger it in the test suite, add a post with a date formatting like this:

date: 2022-06-05

(With no quotes around the date!)

Look into this uncovered another minor issue with date handing: If front-matter parses a date with no time, it will set the time to midnight. But if the Jekyll importing code parses a date with no time as string, the time gets set to noon. For consistency, the importing code should just not set the hour, minute and second fields in the date object so the default values are used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions