Skip to content

Error reading localeDataΒ #376

@mdellanave

Description

@mdellanave

I found an unhandled exception if I try to set locale on an empty date picker
jQuery('#myDTP').datetimepicker('locale', 'it');

This is the code that throw the error

this.actualFormat = format.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
        return (self.isInitFormatting && self._options.date === null ? self.getMoment() : self._dates[0]).localeData().longDateFormat(formatInput) || formatInput; //todo taking the first date should be ok
      });

it could be simply solved adding the ?
(self.isInitFormatting && self._options.date === null ? self.getMoment() : self._dates[0])**?**.localeData()

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