Debian Codegraph @

dojox/date/tests/HebrewDateTest1.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3 <head>
4 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="locale: 'he', parseOnLoad: true, isDebug: true, extraLocale: ['he', 'ru']"></script>
5 <script language="javascript" type="text/javascript">
6 dojo.require("dojox.date.hebrew");
7 dojo.require("dojox.date.hebrew.Date");
8 dojo.require("dojox.date.hebrew.locale");
9 dojo.require("dijit.form.Button");
10 </script>
11 </head>
12 <body>
13 Date in Hebrew calendar:
14 &nbsp;&nbsp;&nbsp;
15 <br>
16 <br>
17 <label for="list_input">Date input Hebrew calendar</label>
18 <input type="text" id="list_input" NAME="list_input" style="width: 400px;">
19 <script type="text/javascript">
20 var date = new dojox.date.hebrew.Date();
21 var year = date.getFullYear();
22 function onButtonClick(){ //from gregorian to hebrew, use pattern
23 var date = new dojox.date.hebrew.Date();
24 var grdate = new Date();
25 var pat = dojo.trim(document.getElementById('Text5').value);
26 var options = {datePattern:pat, selector:'date'};
27 document.getElementById('Text4').value = dojox.date.hebrew.locale.format(date.fromGregorian(grdate), options);
28 }
29 function onButtonClickH(){ //from hebrew, use pattern
30 var str = dojo.trim(document.getElementById('list_input').value);
31 var pattstr = dojo.trim(document.getElementById('Text2').value);
32 // timePattern:'hh:mm:ss'
33 var options = {datePattern:pattstr, selector:'date'};
34 var dateH = dojox.date.hebrew.locale.parse (str, options);
35 document.getElementById('Text3').value = dateH.toGregorian();
36 }
37 function ListChange(){
38 var dropdownIndex = document.getElementById('setvaluetest').selectedIndex;
39 var dropdownValue = document.getElementById('setvaluetest')[dropdownIndex].value;
40 document.getElementById('Text2').value = dropdownValue;
41 }
42 </script>
43 </input>
44 <label for="Text2">Type Pattern for input</label>
45 <input ID="Text2" NAME="Text2" ></input>
46 <label for="setvaluetest">Select Pattern for input</label>
47 <select id="setvaluetest"
48 name="state1"
49 onChange="ListChange()"
50 >
51 <option VALUE = "d MMMM yyyy" selected >d MMMM yyyy</option>
52 <option VALUE = "EEEE d MMMM yyyy" >EEEE d MMMM yyyy</option>
53 <option VALUE = "dd/MM/yy" >dd/MM/yy</option>
54 <option VALUE = "d MM yy" >d MM yy</option>
55 </select>
56 <br>
57 <br>
58 <BR>
59 <label for="Text3">Output Gregorian calendar</label>
60 <input type="text" ID="Text3" NAME="Text3" style="width: 400px;"></input>
61 <button onclick="onButtonClickH()" type="button" ID="Button3"> Convert from input to Greg</button>
62 <br>
63 ///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
64 <br>
65 <br>
66 <label for="Text5">Type Pattern for Hebrew output</label>
67 <input type="text" ID="Text5" NAME="Text5"></input>
68 <label for="Select1">Select Pattern for Hebrew output</label>
69 <select id="Select1"
70 name="state1"
71 onChange="Change()"
72 >
73 <option VALUE = "d MMMM yyyy" selected>d MMMM yyyy</option>
74 <option VALUE = "EEEE d MMMM yyyy" >EEEE d MMMM yyyy</option>
75 <option VALUE = "dd/MM/yy" >dd/MM/yy</option>
76 <option VALUE = "d MM yy">d MM yy</option>
77 <script type="text/javascript">
78 function Change(){
79 document.getElementById('Text5').value = Select1.options[Select1.selectedIndex].value;
80 }
81 </script>
82 </select>
83 <br>
84 <br>
85 <label for="Text4">Output Hebrew calendar</label>
86 <input type="text" ID="Text4" NAME="Text4" style="width: 400px;"></input>
87 <button onclick="onButtonClick()" type="button" ID="Button1"> Convert today from Gregorian to Hebrew</button>
88 <br>
89 <br>
90 <BR>
91 ///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
92 <br>
93 Test add function
94 <br>
95 <br>
96 <br>
97 <label for="Text6">Type amount number</label>
98 <input type="text" ID="Text6" NAME="Text5" style="width: 100px;"></input>
99 <label for="Select2">Select interval</label>
100 <select id="Select2"
101 name="state2"
102 >
103 <option VALUE = "day" selected>day</option>
104 <option VALUE = "week" >week</option>
105 <option VALUE = "weekday" >weekday</option>
106 <option VALUE = "month">month</option>
107 <option VALUE = "year">year</option>
108 <option VALUE = "hour">hour</option>
109 <option VALUE = "minute">minute</option>
110 <option VALUE = "second">second</option>
111
112 </select>
113 <button onclick="onButtonClickAdd()" type="button" ID="Button2"> Add</button>
114
115 <script type="text/javascript">
116 function onButtonClickAdd(){
117 var dateHebrew= new dojox.date.hebrew.Date();
118 var num = parseInt(document.getElementById('Text6').value);
119 var sel = document.getElementById('Select2');
120 var dateHebrewAdd= dojox.date.hebrew.add(dateHebrew, sel.options[sel.selectedIndex].value, num);
121 var options = {datePattern:'EEEE dd MMMM yyyy HH:mm:ss', selector:'date'};
122 document.getElementById('Text7').value = dojox.date.hebrew.locale.format(dateHebrewAdd,options);
123 }
124 </script>
125 <br>
126 <br>
127 <br>
128 <label for="Text7">Result: added to today</label>
129 <input type="text" ID="Text7" NAME="Text7" style="width: 400px;"></input>
130 <br>
131 <BR>
132 ///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
133 <br>
134 Test difference function
135 <br>
136 <br>
137 <label for="Text8">Type date in format dd MMMM yyyy HH:mm:ss</label>
138 <input type="text" ID="Text8" NAME="Text8" style="width: 200px;"></input>
139 <label for="Text9">Type date in format dd MMMM yyyy HH:mm:ss</label>
140 <input type="text" ID="Text9" NAME="Text9" style="width: 200px;"></input>
141 <br>
142 <label for="Select3">Select interval</label>
143 <select id="Select3"
144 name="state3"
145 >
146 <option VALUE = "day" selected>day</option>
147 <option VALUE = "week" >week</option>
148 <option VALUE = "weekday" >weekday</option>
149 <option VALUE = "month">month</option>
150 <option VALUE = "year">year</option>
151 <option VALUE = "hour">hour</option>
152 <option VALUE = "minute">minute</option>
153 <option VALUE = "second">second</option>
154 </select>
155 <button onclick="onButtonClickDiff()" type="button" ID="Button4"> Diff</button>
156
157 <script type="text/javascript">
158 function onButtonClickDiff(){
159 var dateHebrew1 = dojox.date.hebrew.locale.parse(dojo.trim(document.getElementById('Text8').value), {datePattern:'dd MMMM yyyy HH:mm:ss', selector:'date'});
160 var dateHebrew2= dojox.date.hebrew.locale.parse(dojo.trim(document.getElementById('Text9').value), {datePattern:'dd MMMM yyyy HH:mm:ss', selector:'date'});
161 var sel = document.getElementById('Select3');
162 var dif= dojox.date.hebrew.difference(dateHebrew1, dateHebrew2, sel.options[sel.selectedIndex].value);
163 document.getElementById('Text10').value= dif;
164 }
165 </script>
166 <br>
167 <br>
168 <br>
169 <label for="Text10">Result: difference</label>
170 <input type="text" ID="Text10" NAME="Text10" style="width: 40px;"></input>
171 <br>
172 <br>
173 <P></P>
174 </body>
175 </html>