Skip to content

Inconsistent behaiour of dateFormat and timeFormat #465

@bernosek

Description

@bernosek

Master version: 1.0.4

The problem is in timeFormat argument, when text enclosed in double quotes is treated as a sequence of literar characters. This is not the same with dateFormat. The reason is that the dateFormat is used by original jQuery UI datepicker 's formatDate function, but the timeFormat is processed in timepicker's formatTime function.

For instance, when you use "dd".mm.yy dateFormat, you will get this kind of result: "03".10.2012. But when you use same pattern for timeFormat "hh":mm, you will get "hh":35 as a result and hh is not detected as a hour number.

So I guess it should behave the same and double quotes should not be used for enclosing sequence of literars. Only single quote should do it (as it is for original datepicker). The change in code is quite simple, just remove the ".*?" from regular expression in $.datepicker.formatTime timepicker function. The new line should look like this:

tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions