summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2018-11-06 15:23:40 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2018-11-06 15:42:52 +0000
commit244a960a509ce4b8476f0ad9e3e3d1cd4bc381d6 (patch)
tree42da4eeb3361b4ad8f6e058088dac4227316771e /source
parent9b183c560ef9183f7d4ab32af56d8bad0b494f36 (diff)
downloadmupdf-244a960a509ce4b8476f0ad9e3e3d1cd4bc381d6.tar.xz
Update AFParseDateEx to handle dates as a contiguous string of digits.
Update to match Adobe Reader's behaviour. This fixes bug #700128.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/js/util.js13
-rw-r--r--source/pdf/js/util.js.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/source/pdf/js/util.js b/source/pdf/js/util.js
index dd58dff7..038014c3 100644
--- a/source/pdf/js/util.js
+++ b/source/pdf/js/util.js
@@ -554,6 +554,19 @@ function AFParseDateEx(d, fmt) {
dout.setHours(12, 0, 0);
+ if (nums.length == 1 && nums[0].length == fmt.length && !text_month) {
+ // One number string, exactly matching the format string in length.
+ // Split it into separate strings to match the fmt
+ var num = nums[0];
+ nums = [""];
+ for (i = 0; i < fmt.length; i++)
+ {
+ nums[nums.length-1] += num.charAt(i);
+ if (i+1 < fmt.length && fmt.charAt(i) != fmt.charAt(i+1))
+ nums.push("");
+ }
+ }
+
if (!nums || nums.length < 1 || nums.length > 3)
return null;
diff --git a/source/pdf/js/util.js.h b/source/pdf/js/util.js.h
index a8bf9619..2cf8a0af 100644
--- a/source/pdf/js/util.js.h
+++ b/source/pdf/js/util.js.h
@@ -554,6 +554,19 @@
"\n"
"dout.setHours(12, 0, 0);\n"
"\n"
+"if (nums.length == 1 && nums[0].length == fmt.length && !text_month) {\n"
+"\n"
+"\n"
+"var num = nums[0];\n"
+"nums = [\"\"];\n"
+"for (i = 0; i < fmt.length; i++)\n"
+"{\n"
+"nums[nums.length-1] += num.charAt(i);\n"
+"if (i+1 < fmt.length && fmt.charAt(i) != fmt.charAt(i+1))\n"
+"nums.push(\"\");\n"
+"}\n"
+"}\n"
+"\n"
"if (!nums || nums.length < 1 || nums.length > 3)\n"
"return null;\n"
"\n"