tsepez | 86a61dc | 2016-03-25 10:00:11 -0700 | [diff] [blame] | 1 | {{header}} |
| 2 | {{object 1 0}} << |
| 3 | /Type /Catalog |
| 4 | /Pages 2 0 R |
| 5 | /OpenAction 10 0 R |
| 6 | >> |
| 7 | endobj |
| 8 | {{object 2 0}} << |
| 9 | /Type /Pages |
| 10 | /Count 1 |
| 11 | /Kids [ |
| 12 | 3 0 R |
| 13 | ] |
| 14 | >> |
| 15 | endobj |
| 16 | % Page number 0. |
| 17 | {{object 3 0}} << |
| 18 | /Type /Page |
| 19 | /Parent 2 0 R |
| 20 | /Resources << |
| 21 | /Font <</F1 15 0 R>> |
| 22 | >> |
| 23 | /Contents [21 0 R] |
| 24 | /MediaBox [0 0 612 792] |
| 25 | >> |
| 26 | % OpenAction action |
| 27 | {{object 10 0}} << |
| 28 | /Type /Action |
| 29 | /S /JavaScript |
| 30 | /JS 11 0 R |
| 31 | >> |
| 32 | endobj |
| 33 | % JS program to exexute |
| 34 | {{object 11 0}} << |
| 35 | >> |
| 36 | stream |
| 37 | function TestOneFormat(str, d) { |
| 38 | try { |
| 39 | app.alert(str + ": " + util.printd(str, d)); |
| 40 | } |
| 41 | catch (e) { |
| 42 | app.alert(str + ": Caught error: " + e); |
| 43 | } |
| 44 | } |
| 45 | function TestOneXFAFormat(str, d, flag) { |
| 46 | try { |
| 47 | app.alert(str + ": " + util.printd(str, d, flag)); |
| 48 | } |
| 49 | catch (e) { |
| 50 | app.alert(str + ": Caught error: " + e); |
| 51 | } |
| 52 | } |
| 53 | // July 4th, 2014 11:59:59 AM local time. |
| 54 | var d1 = new Date(2014, 06, 04, 15, 59, 58); |
| 55 | TestOneFormat("mm/dd/yyyy HH:MM:ss", d1); |
| 56 | TestOneFormat(0, d1); |
| 57 | TestOneFormat(1, d1); |
| 58 | TestOneFormat(2, d1); |
| 59 | TestOneFormat(3, d1); |
| 60 | TestOneFormat("mmmm", d1); |
| 61 | TestOneFormat("mmm", d1); |
| 62 | TestOneFormat("mm", d1); |
| 63 | TestOneFormat("m", d1); |
| 64 | TestOneFormat("dddd", d1); |
| 65 | TestOneFormat("ddd", d1); |
| 66 | TestOneFormat("dd", d1); |
| 67 | TestOneFormat("d", d1); |
| 68 | TestOneFormat("yyyy", d1); |
| 69 | TestOneFormat("yy", d1); |
| 70 | TestOneFormat("HH", d1); |
| 71 | TestOneFormat("H", d1); |
| 72 | TestOneFormat("hh", d1); |
| 73 | // "h" is inconsitent between platforms: " 3" vs. "3" |
| 74 | TestOneFormat("MM", d1); |
| 75 | TestOneFormat("M", d1); |
| 76 | TestOneFormat("ss", d1); |
| 77 | TestOneFormat("s", d1); |
| 78 | // "tt" is inconsitent between platforms: "PM" vs, "pm" vs. "P" |
| 79 | TestOneFormat("t", d1); |
| 80 | TestOneFormat("abc.efg.i.kl.nopqr..uvwxyzABC.EFG.I.KL.NOPQR..UVWXYZ0123456780", d1); |
| 81 | TestOneFormat("!@#$^&*()-_<>[];:~", d1); |
| 82 | TestOneFormat("%z %d %%z %%d %%%z %%%d %%% hh:MM", d1); |
| 83 | TestOneFormat("", d1); |
| 84 | TestOneFormat("mm/dd/yyyy", d1); |
| 85 | TestOneFormat("mm/dd/yyyy", new Date(1850, 0, 1)); |
| 86 | TestOneFormat("mm/dd/yyyy", new Date(2525, 11, 31)); |
| 87 | TestOneFormat("mm/dd/yyyy"); |
| 88 | TestOneFormat(); |
| 89 | TestOneFormat("mm/dd/yyyy", 42); |
| 90 | TestOneFormat("mm/dd/yyyy", "clams"); |
| 91 | TestOneFormat("mm/dd/yyyy", {"clams": 3}); |
| 92 | TestOneFormat("mm/dd/yyyy", ["clams", 3]); |
| 93 | TestOneFormat({"clams": 3}, d1); |
| 94 | TestOneFormat(["clams", 3], d1); |
| 95 | TestOneXFAFormat("mm", d1, false); |
| 96 | TestOneXFAFormat("mm", d1, true); |
Lei Zhang | 2bf942d | 2017-06-16 13:48:19 -0700 | [diff] [blame^] | 97 | |
| 98 | // Date with year 0. |
| 99 | // TODO(thestig): Why is the output different from Acrobat? |
| 100 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(0, 06, 04, 15, 59, 58)); |
| 101 | // Date with month 20. |
| 102 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 04, 15, 59, 58)); |
| 103 | // Date with day 100. |
| 104 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 100, 15, 59, 58)); |
| 105 | // Date with hour 50 |
| 106 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 50, 59, 58)); |
| 107 | // Date with minute 1234. |
| 108 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 1234, 58)); |
| 109 | // Date with second 65. |
| 110 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, 65)); |
| 111 | // Date with April 31th. |
| 112 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 03, 31, 15, 59, 58)); |
| 113 | // Date with February 30th. |
| 114 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 01, 30, 15, 59, 58)); |
| 115 | // Date with negative year. |
| 116 | // Acrobat prints out "07/04/-001 15:59:58" but handling this rarely used case |
| 117 | // outside of FXSYS_wcsftime() is a lot of work. |
| 118 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(-1, 06, 04, 15, 59, 58)); |
| 119 | // Date with negative month. |
| 120 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, -1, 30, 15, 59, 58)); |
| 121 | // Date with negative day. |
| 122 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, -1, 15, 59, 58)); |
| 123 | // Date with negative hour. |
| 124 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, -1, 59, 58)); |
| 125 | // Date with negative minute. |
| 126 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, -1, 58)); |
| 127 | // Date with negative second. |
| 128 | TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, -1)); |
tsepez | 86a61dc | 2016-03-25 10:00:11 -0700 | [diff] [blame] | 129 | endstream |
| 130 | endobj |
| 131 | {{xref}} |
| 132 | trailer << |
| 133 | /Root 1 0 R |
| 134 | >> |
| 135 | {{startxref}} |
| 136 | %%EOF |