Skip to content

Passing function to format without also passing parser results in errors #210

@mryellow

Description

@mryellow

Errors trying to do .match() on a function rather than a string.

const getParsableDate = ({
dateStr,
formatStr,
translation,
currentYear,
time,
}) => {
const splitter = formatStr.match(/-|\/|\s|\./) || ['-']
const df = formatStr.split(splitter[0])

Passing the undocumented parser property results in bypassing this codepath and no longer expecting format to always be a string:

if (parser) {
return parseDateWithLibrary(dateStr, format, parser)
}

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