blob: 4d8610d429e5cd8230ed9fc9b5c653f5927c42d0 [file] [log] [blame]
tsepez86a61dc2016-03-25 10:00:11 -07001{{header}}
2{{object 1 0}} <<
3 /Type /Catalog
4 /Pages 2 0 R
5 /OpenAction 10 0 R
6>>
7endobj
8{{object 2 0}} <<
9 /Type /Pages
10 /Count 1
11 /Kids [
12 3 0 R
13 ]
14>>
15endobj
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>>
32endobj
33% JS program to exexute
34{{object 11 0}} <<
35>>
36stream
37function 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}
45function 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.
54var d1 = new Date(2014, 06, 04, 15, 59, 58);
55TestOneFormat("mm/dd/yyyy HH:MM:ss", d1);
56TestOneFormat(0, d1);
57TestOneFormat(1, d1);
58TestOneFormat(2, d1);
59TestOneFormat(3, d1);
60TestOneFormat("mmmm", d1);
61TestOneFormat("mmm", d1);
62TestOneFormat("mm", d1);
63TestOneFormat("m", d1);
64TestOneFormat("dddd", d1);
65TestOneFormat("ddd", d1);
66TestOneFormat("dd", d1);
67TestOneFormat("d", d1);
68TestOneFormat("yyyy", d1);
69TestOneFormat("yy", d1);
70TestOneFormat("HH", d1);
71TestOneFormat("H", d1);
72TestOneFormat("hh", d1);
73// "h" is inconsitent between platforms: " 3" vs. "3"
74TestOneFormat("MM", d1);
75TestOneFormat("M", d1);
76TestOneFormat("ss", d1);
77TestOneFormat("s", d1);
78// "tt" is inconsitent between platforms: "PM" vs, "pm" vs. "P"
79TestOneFormat("t", d1);
80TestOneFormat("abc.efg.i.kl.nopqr..uvwxyzABC.EFG.I.KL.NOPQR..UVWXYZ0123456780", d1);
81TestOneFormat("!@#$^&*()-_<>[];:~", d1);
82TestOneFormat("%z %d %%z %%d %%%z %%%d %%% hh:MM", d1);
83TestOneFormat("", d1);
84TestOneFormat("mm/dd/yyyy", d1);
85TestOneFormat("mm/dd/yyyy", new Date(1850, 0, 1));
86TestOneFormat("mm/dd/yyyy", new Date(2525, 11, 31));
87TestOneFormat("mm/dd/yyyy");
88TestOneFormat();
89TestOneFormat("mm/dd/yyyy", 42);
90TestOneFormat("mm/dd/yyyy", "clams");
91TestOneFormat("mm/dd/yyyy", {"clams": 3});
92TestOneFormat("mm/dd/yyyy", ["clams", 3]);
93TestOneFormat({"clams": 3}, d1);
94TestOneFormat(["clams", 3], d1);
95TestOneXFAFormat("mm", d1, false);
96TestOneXFAFormat("mm", d1, true);
Lei Zhang2bf942d2017-06-16 13:48:19 -070097
98// Date with year 0.
99// TODO(thestig): Why is the output different from Acrobat?
100TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(0, 06, 04, 15, 59, 58));
101// Date with month 20.
102TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 04, 15, 59, 58));
103// Date with day 100.
104TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 20, 100, 15, 59, 58));
105// Date with hour 50
106TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 50, 59, 58));
107// Date with minute 1234.
108TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 1234, 58));
109// Date with second 65.
110TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, 65));
111// Date with April 31th.
112TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 03, 31, 15, 59, 58));
113// Date with February 30th.
114TestOneFormat("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.
118TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(-1, 06, 04, 15, 59, 58));
119// Date with negative month.
120TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, -1, 30, 15, 59, 58));
121// Date with negative day.
122TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, -1, 15, 59, 58));
123// Date with negative hour.
124TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, -1, 59, 58));
125// Date with negative minute.
126TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, -1, 58));
127// Date with negative second.
128TestOneFormat("mm/dd/yyyy HH:MM:ss", new Date(2014, 06, 04, 15, 59, -1));
tsepez86a61dc2016-03-25 10:00:11 -0700129endstream
130endobj
131{{xref}}
132trailer <<
133 /Root 1 0 R
134>>
135{{startxref}}
136%%EOF