Skip to content

Some older browsers may fail parse dates with Date Formatter because of incorrect parseInt() calls #22

Closed
@beholder4096

Description

@beholder4096

Hi,

Prerequisites

  • I have attempted to find the simplest possible steps to reproduce the issue.

Steps to reproduce the issue

  1. Pull Opera 12 from somewhere
  2. set up a test environment in Opera and initialize the Date Formatter with:
    var df = new DateFormatter();
  3. call df.parseDate("08-13-2019", 'm-d-Y') to see what you get.

Expected behavior and actual behavior

When I follow those steps, I see...

null in Opera console. The bug happens because you call parseInt() only with first parameter. When the string "08" is parsed, it is considered to be octal and is not parsed properly. You should add an additional parameter with radix 10 to all parseInt() calls to fix this behavior on all older browsers. I spent hours tracking and fixing this issue.

I was expecting...
date (with type date)

Environment

Browsers
Opera 12

Operating System

  • Windows

Libraries

  • jQuery version: any
  • php-date-formatter version: latest

Isolating the problem

  • [ x] The bug happens consistently in Opera 12

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions