Skip to content

Extra characters tolerated in dateParse and numberParse #492

Closed
@alienintheheights

Description

@alienintheheights

Using 1.0.0. It seems that gibberish input is getting parsed instead of returning null/NaN.

locale = "pt_BR";
value = "12:12 am sdfsdf33dfllsdf lll;;lk";
Globalize(locale).dateParser({time:"short"})(value)

=> Wed Aug 26 2015 12:12:00 GMT-0500 (CDT)

How is this valid?

Similarly,

locale = "en";
value = "123123 sdfsdf;;dfllsdf";
Globalize(locale).numberParser()(value)

=> 123123

Shouldn't Globalize object to this sort of input??

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