Skip to content

Partially matching date pattern is accepted for dt. #129

@Zegnat

Description

@Zegnat

Sorry for the cryptic title.

It looks like the parser does not require an exact match for ISO 8601 patterns to accept something as a valid date. This makes for really weird timestamps, and odd implied dates. Example:

<span class="h-event">
  <span class="dt-start">
    <span class="value" title="May 31, 2017">🐔 2017-05-31</span>
    <span class="value" title="17:30">17:30</span>
  </span><span class="dt-end">19:30</span>
</span>

Current output:

{
    "type": [
        "h-event"
    ],
    "properties": {
        "start": [
          "\ud83d\udc14 2017-05-31T17:30"
        ],
        "end": [
          "\ud83d\udc14 2017-05-31T19:30"
        ],
        "name": [
          "\ud83d\udc14 2017-05-31\r\n    17:30\r\n  \r\n  \u2013\r\n  19:30"
        ]
    }
}

The expected output does not include a T in start because it is not a valid ISO timestamp, it should just be a concatenation of the separate strings using “ ”. It also does not include any date info in end, as no other valid date has been found. That is:

{
    "type": [
        "h-event"
    ],
    "properties": {
        "start": [
          "\ud83d\udc14 2017-05-31 17:30"
        ],
        "end": [
          "19:30"
        ],
        "name": [
          "\ud83d\udc14 2017-05-31\r\n    17:30\r\n  \r\n  \u2013\r\n  19:30"
        ]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions