Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1985

strict client site date parsing allows certain characters

XMLWordPrintable

      parsing an incorrect date with strict=true (lenient=false on the datebox component) will usually refuse to accept dates like this
      zk.fmt.Date.parseDate("Oct 8, 20f11", "MMM d, yyyy", true) -> undefined

      however characters present in the format string ('d', 'M', 'y', ','(comma), ' '(space)) will not cause the parsing to fail

      zk.fmt.Date.parseDate("Oct 18, 20d11 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 20M11 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 20y11 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 20,11 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 20 11 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 1d8, 2011 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 1M8, 2011 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 1y8, 2011 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 1,8, 2011 11:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 1d1:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 1M1:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 1y1:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 1 1:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 1,1:11:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:1d1:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:1M1:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:1y1:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:1 1:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:1,1:11", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:11:1d1", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:11:1M1", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:11:1y1", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:11:1 1", "MMM d, yyyy HH:mm:ss", true)
      zk.fmt.Date.parseDate("Oct 18, 2011 11:11:1,1", "MMM d, yyyy HH:mm:ss", true)

      There is an if statement in datefmt.js in line 366, that allows these characters, resulting in incorrectly parsed dates instead of parsing errors

            noahhuang noahhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: