PageSourceSearch

https://sdec.kr/js/module/datepicker.js

js sdec.kr collected 2026-09-27 10:20:22 UTC 54,995 bytes, 1,528 lines download raw bytes

1(function ($) {
2	if(typeof jQuery === 'undefined') {
3		throw 'jQuery not loaded';
4	}
5	var datepicker = function(elem, opt) {
6		var picker = {},
7		widget = false,
8
9		getTemplateHead = function() {
10			var template = '';
11			template += '<div class="ui-datepicker-close" style="' + (opt.showClose === false ? ' display: none; ' : '') + '">&times;</div>';
12			if(opt.theme == 'duration' || opt.theme == 'duration-mobile') {
13				var d_today = convertDateString(new Date().getTime());
14				var d_yesterday = convertDateString(new Date().getTime() - 86400000);
15				var d_7daysago = convertDateString(new Date().getTime() - (86400000 * 7));
16				var d_30daysago = convertDateString(new Date().getTime() - (86400000 * 30));
17
18				var d_closest_monday = convertDateString(new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() == 0 ? 6 : new Date().getDay() - 1)))));
19				var d_closest_sunday = convertDateString(new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() == 0 ? 6 : new Date().getDay() - 1 - 6)))));
20				var d_lastweek_monday = convertDateString(new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() == 0 ? 6 : new Date().getDay() - 1))) - (86400000 * 7)));
21				var d_lastweek_sunday = convertDateString(new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() == 0 ? 6 : new Date().getDay() - 1 - 6))) - (86400000 * 7)));
22				var d_thismonth_firstday = convertDateString(new Date(new Date().setDate(1)));
23				var d_thismonth_lastday = convertDateString(new Date(new Date(new Date().setMonth(new Date().getMonth()+1)).setDate(0)));
24				var d_lastmonth_firstday = convertDateString(new Date(new Date(new Date().setMonth(new Date().getMonth()-1)).setDate(1)));
25				var d_lastmonth_lastday = convertDateString(new Date(new Date(new Date().setMonth(new Date().getMonth())).setDate(0)));
26
27				template += '<div class="ui-datepicker-selectduration">\
28								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_today + '" data-end_date="' + d_today + '">' + $.lang[LANG]['shopping.statistics.today'] + '</div>\
29								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_yesterday + '" data-end_date="' + d_yesterday + '">' + $.lang[LANG]['shopping.statistics.yesterday'] + '</div>\
30								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_7daysago + '" data-end_date="' + d_yesterday + '">' + $.lang[LANG]['shopping.statistics.7daysago'] + '</div>\
31								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_30daysago + '" data-end_date="' + d_yesterday + '">' + $.lang[LANG]['shopping.statistics.30daysago'] + '</div>\
32								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_lastweek_monday + '" data-end_date="' + d_lastweek_sunday + '">' + $.lang[LANG]['shopping.statistics.lastweek'] + '</div>\
33								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_closest_monday + '" data-end_date="' + d_closest_sunday + '">' + $.lang[LANG]['shopping.statistics.thisweek'] + '</div>\
34								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_lastmonth_firstday + '" data-end_date="' + d_lastmonth_lastday + '">' + $.lang[LANG]['shopping.statistics.lastmonth'] + '</div>\
35								<div class="ui-datepicker-selectduration-item" data-start_date="' + d_thismonth_firstday + '" data-end_date="' + d_thismonth_lastday + '">' + $.lang[LANG]['shopping.statistics.thismonth'] + '</div>\
36							</div>\
37				';
38			}
39			template += '<div class="ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-datepicker-multi ' + (opt.viewCount > 1 ? ('ui-datepicker-multi-' + opt.viewCount) : '')  + ' " style="display: block;">\
40			';
41
42			return template;
43		},
44		getDurationTemplateBody = function() {
45			var leftStartDate = '';
46			var rightStartDate = '';
47
48			if(picker.leftDispDate) {
49				leftStartDate = picker.leftDispDate;
50			} else {
51				leftStartDate = picker.leftCurrentDate;
52			}
53
54			if(picker.rightDispDate) {
55				rightStartDate = picker.rightDispDate;
56			} else {
57				rightStartDate = picker.rightCurrentDate;
58			}
59
60			var leftCurrentDateArr 		= leftStartDate.split("-");
61	        var leftCurrentDateYear 	= leftCurrentDateArr[0];
62	        var leftCurrentDateMonth 	= leftCurrentDateArr[1];
63	        var leftCurrentDateDay 		= leftCurrentDateArr[2];
64
65			var rightCurrentDateArr 	= rightStartDate.split("-");
66	        var rightCurrentDateYear 	= rightCurrentDateArr[0];
67	        var rightCurrentDateMonth 	= rightCurrentDateArr[1];
68	        var rightCurrentDateDay 	= rightCurrentDateArr[2];
69
70
71        	var sundayClass = ' date-sunday ';
72        	var saturdayClass = ' date-saturday ';
73        	var holidayClass = ' date-holiday ';
74        	var useableClass = ' ui-state-default ';
75        	var activeClass = ' dp-highlight ';
76        	var startClass = ' dp-first ';
77        	var endClass = ' dp-end ';
78        	var betweenClass = ' pd-between ';
79
80	       	var template = '';
81
82
83	        if(opt.minDate) {
84	        	var minDateTime = getDateTime(opt.minDate);
85	        }
86
87	        if(opt.maxDate) {
88	        	var maxDateTime = getDateTime(opt.maxDate);
89	        }
90
91	        var currentDateArr;
92			var currentDateYear;
93			var currentDateMonth;
94			var currentDateDay;
95
96	        for(var i=0; i<2; i++) {
97	        	if(i == 0) {
98	        		currentDateArr   	= leftCurrentDateArr;	
99					currentDateYear 	= leftCurrentDateYear;
100					currentDateMonth 	= leftCurrentDateMonth;
101					currentDateDay 		= leftCurrentDateDay;
102	        	} else if(i == 1) {
103	        		currentDateArr 		= rightCurrentDateArr;	
104					currentDateYear 	= rightCurrentDateYear;
105					currentDateMonth 	= rightCurrentDateMonth;
106					currentDateDay 		= rightCurrentDateDay;
107	        	}
108				var currentStartDate = new Date(currentDateYear, Number(currentDateMonth)-1, 1);
109				var currentEndDate = new Date(currentDateYear, Number(currentDateMonth), 0);
110				var currentStartDay = 1;
111				var currentEndDay = currentEndDate.getDate();
112				var dayArr = new Array();
113				var startWeek = currentStartDate.getDay();
114
115				var currentYear = currentStartDate.getFullYear();
116				var currentMonth = (Number(currentStartDate.getMonth())+1) < 10 ? "0" + (Number(currentStartDate.getMonth())+1) : Number(currentStartDate.getMonth())+1;
117
118
119				for (var ii=0; ii<startWeek; ii++) {
120					dayArr[ii] = '';
121				}		
122
123				for(var ii=1; ii<=currentEndDay; ii++) {
124					dayArr[startWeek] = ii;
125					startWeek++;
126				}
127
128				template += '<div class="ui-datepicker-group ' + (i==0 ? ' ui-datepicker-group-left ' : ' ui-datepicker-group-right ') + '">\
129								<div class="ui-datepicker-datetitle">' + (i == 0 ? $.lang[LANG]['shopping.statistics.startdate'] : $.lang[LANG]['shopping.statistics.enddate'] ) + '</div>\
130									<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-left">';
131				if(opt.minDate) {
132					if(minDateTime < new Date(currentYear-1, currentMonth, 0).getTime()) {
133						template += '<a class="ui-datepicker-prev-year ui-corner-all" title="이전년도">\
134										<span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevYearText + '</span>\
135									</a>';
136					}
137					if(minDateTime < new Date(currentYear, currentMonth-1, 0).getTime()) {
138						template += '<a class="ui-datepicker-prev ui-corner-all" title="이전">\
139							                <span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevText + '</span>\
140							         </a>';
141					}
142				} else {
143					template += '<a class="ui-datepicker-prev-year ui-corner-all" title="이전년도">\
144									<span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevYearText + '</span>\
145								</a>';
146
147					template += '<a class="ui-datepicker-prev ui-corner-all" title="이전">\
148						                <span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevText + '</span>\
149						         </a>';
150
151				}
152
153				if(opt.maxDate) {
154					if(maxDateTime > new Date(currentYear+1, currentMonth-1, 0).getTime()) {
155						template += '<a class="ui-datepicker-next-year ui-corner-all" title="다음년도">\
156										<span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextYearText + '</span>\
157									</a>';
158					}
159					if(maxDateTime > new Date(currentYear, currentMonth, 0).getTime()) {
160						template += '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="다음">\
161							              <span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextText + '</span>\
162							         </a>';		            
163					}
164				} else {
165					template += '<a class="ui-datepicker-next-year ui-corner-all" title="다음년도">\
166									<span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextYearText + '</span>\
167								</a>';
168
169					template += '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="다음">\
170						              <span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextText + '</span>\
171						         </a>';		            
172				}
173
174
175
176				template += '<div class="ui-datepicker-title">\
177						    	<span class="ui-datepicker-year">' + currentYear + '</span>.&nbsp;<span class="ui-datepicker-month ui-datepicker-m3">' + currentMonth + '</span>\
178						     </div>\
179						</div>';
180
181
182				template += ' <table class="ui-datepicker-calendar ' + (opt.range ? ' ui-datepicker-range ' : '')  + '">\
183		            <thead>\
184		                <tr>';
185
186		        for(var ii=0; ii<=6; ii++) {
187		        	template += '<th class="' + (ii==0 || ii==6 ? 'ui-datepicker-week-end' : '') + '">\
188		                        	<span class="' + (ii==0 ? ' Sunday' : '') + (ii==6 ? ' Saturday' : '') + '">' + opt.weekText[ii] + '</span>\
189		                    	</th>';
190		        }
191		        
192		        template += '</tr>\
193		            	</thead>';
194
195
196		        template += '<tbody>';
197
198	        	var pickerDateTime = '';
199
200
201	        	if(opt.range === false) {
202	        		if(opt.multiSelect === false) {
203	        			if(picker.currentDate) {
204		        			var pickerDate = picker.currentDate;
205		        			var pickerDateArr = pickerDate.split("-");
206		        			var pickerYear = pickerDateArr[0];
207		        			var pickerMonth = pickerDateArr[1];
208		        			var pickerDay = pickerDateArr[2];
209		        			pickerDateTime = new Date(pickerYear, Number(pickerMonth)-1, pickerDay).getTime();
210		        		}
211	        		} else {
212	        			var pickerDateArr = new Array();
213	        			$(picker.currentDateArr).each(function() {
214	        				var pickerDateSplit = this.split("-");
215	        				var pickerYear = pickerDateSplit[0];
216	        				var pickerMonth = pickerDateSplit[1];
217	        				var pickerDay = pickerDateSplit[2];
218	        				pickerDateTime = new Date(pickerYear, Number(pickerMonth)-1, pickerDay).getTime();
219	        				pickerDateArr.push(pickerDateTime);
220	        			});
221	        		}
222	        	} else {
223	        		// if(i == 0) {
224		        		var pickerStartDate = picker.startDate;
225		        		var pickerStartDateArr = pickerStartDate.split("-");
226		        		var pickerStartYear = pickerStartDateArr[0];
227		        		var pickerStartMonth = pickerStartDateArr[1];
228		        		var pickerStartDay = pickerStartDateArr[2];
229
230		        		var pickerEndDate = picker.endDate;
231		        		var pickerEndDateArr = pickerEndDate.split("-");
232		        		var pickerEndYear = pickerEndDateArr[0];
233		        		var pickerEndMonth = pickerEndDateArr[1];
234		        		var pickerEndDay = pickerEndDateArr[2];
235
236		        		pickerStartDateTime = new Date(pickerStartYear, Number(pickerStartMonth)-1, pickerStartDay).getTime();
237		        		pickerEndDateTime = new Date(pickerEndYear, Number(pickerEndMonth)-1, pickerEndDay).getTime();
238					// }
239	        	}
240
241
242
243		        $(dayArr).each(function(key) {
244		        	var tdClass = '';
245		        	var aClass = '';
246		        	if(key == 0 || key % 7 == 0) {
247		        		template += '<tr>';
248		        		tdClass += sundayClass;
249		        	}
250
251		        	if(key % 7 == 6) tdClass += saturdayClass;
252
253		        	
254
255		        	if(this != '') {
256		        		aClass += useableClass;
257						var currentDateTime = new Date(currentYear, currentMonth-1, this).getTime();
258		        		if(opt.range === false) {
259		        			if(opt.multiSelect === false) {
260					        	if(currentDateTime == pickerDateTime) tdClass += activeClass;
261					        } else {
262					        	if(pickerDateArr.indexOf(currentDateTime) > -1) tdClass += activeClass;
263					        }
264				        } else {
265				        	var flag = false;
266				        	if(currentDateTime == pickerStartDateTime) {
267				        		tdClass += activeClass + startClass;
268				        	}
269
270			        		if(currentDateTime > pickerStartDateTime && currentDateTime < pickerEndDateTime) {
271			        			tdClass += activeClass + betweenClass;
272			        		}
273
274				        	if(currentDateTime == pickerEndDateTime) {
275				        		tdClass += activeClass + endClass;
276				        		flag = false;
277				        	}
278				        }
279
280				        if(opt.minDate) {
281				        	if(currentDateTime < minDateTime) {
282				        		tdClass = ' ui-state-disabled ';
283				        		aClass = '';
284				        	}
285				        }
286
287				        if(opt.maxDate) {
288							if(currentDateTime > maxDateTime) {
289								tdClass = ' ui-state-disabled ';
290								aClass = '';
291							}				        	
292				        }
293
294				        if(opt.disabledDays) {
295				        	if($.inArray(currentDateTime, picker.disabledDateTime) > -1) {
296								tdClass = ' ui-state-disabled ';
297								aClass = '';
298				        	}
299				        }
300
301				        if(opt.holidays) {
302				        	if($.inArray(currentDateTime, picker.holidaysDateTime) > -1) {
303								tdClass += ' date-holiday ';
304				        	}
305				        }
306
307				        if(currentDateTime == new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()).getTime()) {
308				        	tdClass += ' ui-datepicker-today ';
309				        }
310
311			        }
312
313
314		        	template += '<td class="' + tdClass + '" data-handler="selectDay" data-event="click" data-month="' + currentMonth + '" data-year="' + currentYear + '" data-day="' + (this < 10 ? '0' + this : this) + '">\
315		                       	 	<a class="' + aClass + '">' + (this != '' ? this : '') + '</a>\
316		                    	</td>';
317
318		        	if(key > 0 && key % 7 == 6) {
319		        		template += '</tr>';
320		        	}
321		        });
322
323		        template += '</tbody>';
324		        template += '</table>'
325		        template += '</div>';
326			}
327
328			if(opt.useTime === true) template += getTimeTemplate();
329
330			return template;
331		},
332
333		getTemplateBody = function() {
334
335			var startDate = '';
336
337	        if(picker.dispDate) {
338	        	startDate = picker.dispDate;
339	        } else {
340	        	startDate = picker.currentDate;
341	        }
342
343	        var currentDateArr = startDate.split("-");
344	        var currentDateYear = currentDateArr[0];
345	        var currentDateMonth = currentDateArr[1];
346	        var currentDateDay = currentDateArr[2];
347
348
349        	var sundayClass = ' date-sunday ';
350        	var saturdayClass = ' date-saturday ';
351        	var holidayClass = ' date-holiday ';
352        	var useableClass = ' ui-state-default ';
353        	var activeClass = ' dp-highlight ';
354        	var startClass = ' dp-first ';
355        	var endClass = ' dp-end ';
356        	var betweenClass = ' pd-between ';
357
358	       	var template = '';
359
360
361	        if(opt.minDate) {
362	        	var minDateTime = getDateTime(opt.minDate);
363	        }
364
365	        if(opt.maxDate) {
366	        	var maxDateTime = getDateTime(opt.maxDate);
367	        }
368
369	       
370			for(var i=0; i<opt.viewCount; i++) {
371				var currentStartDate = new Date(currentDateYear, Number(currentDateMonth)-1+i, 1);
372				var currentEndDate = new Date(currentDateYear, Number(currentDateMonth)+i, 0);
373				var currentStartDay = 1;
374				var currentEndDay = currentEndDate.getDate();
375				var dayArr = new Array();
376				var startWeek = currentStartDate.getDay();
377
378				var currentYear = currentStartDate.getFullYear();
379				var currentMonth = (Number(currentStartDate.getMonth())+1) < 10 ? "0" + (Number(currentStartDate.getMonth())+1) : Number(currentStartDate.getMonth())+1;
380
381				if(i == 0) {
382					picker.dispYear = currentDateYear;
383					picker.dispMonth = currentDateMonth;
384				}
385
386				for (var ii=0; ii<startWeek; ii++) {
387					dayArr[ii] = '';
388				}		
389
390				for(var ii=1; ii<=currentEndDay; ii++) {
391					dayArr[startWeek] = ii;
392					startWeek++;
393				}
394
395				template += '<div class="ui-datepicker-group">\
396									<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-left">';
397				if(i == 0) {
398					if(opt.minDate) {
399						if(minDateTime < new Date(currentYear-1, currentMonth, 0).getTime()) {
400							template += '<a class="ui-datepicker-prev-year ui-corner-all" title="이전년도">\
401											<span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevYearText + '</span>\
402										</a>';
403						}
404						if(minDateTime < new Date(currentYear, currentMonth-1, 0).getTime()) {
405							template += '<a class="ui-datepicker-prev ui-corner-all" title="이전">\
406								                <span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevText + '</span>\
407								         </a>';
408						}
409					} else {
410						template += '<a class="ui-datepicker-prev-year ui-corner-all" title="이전년도">\
411										<span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevYearText + '</span>\
412									</a>';
413
414						template += '<a class="ui-datepicker-prev ui-corner-all" title="이전">\
415							                <span class="ui-icon ui-icon-circle-triangle-w">' + opt.prevText + '</span>\
416							         </a>';
417
418					}
419				} 
420
421				if(i == (opt.viewCount - 1)) {
422					if(opt.maxDate) {
423						if(maxDateTime > new Date(currentYear+1, currentMonth-1, 0).getTime()) {
424							template += '<a class="ui-datepicker-next-year ui-corner-all" title="다음년도">\
425											<span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextYearText + '</span>\
426										</a>';
427						}
428						if(maxDateTime > new Date(currentYear, currentMonth, 0).getTime()) {
429							template += '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="다음">\
430								              <span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextText + '</span>\
431								         </a>';		            
432						}
433					} else {
434						template += '<a class="ui-datepicker-next-year ui-corner-all" title="다음년도">\
435										<span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextYearText + '</span>\
436									</a>';
437
438						template += '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="다음">\
439							              <span class="ui-icon ui-icon-circle-triangle-e">' + opt.nextText + '</span>\
440							         </a>';		            
441					}
442				} 
443
444
445
446				template += '<div class="ui-datepicker-title">\
447						    	<span class="ui-datepicker-year">' + currentYear + '</span>.&nbsp;<span class="ui-datepicker-month ui-datepicker-m3">' + currentMonth + '</span>\
448						     </div>\
449						</div>';
450
451
452				template += ' <table class="ui-datepicker-calendar ' + (opt.range ? ' ui-datepicker-range ' : '')  + '">\
453		            <thead>\
454		                <tr>';
455
456		        for(var ii=0; ii<=6; ii++) {
457		        	template += '<th class="' + (ii==0 || ii==6 ? 'ui-datepicker-week-end' : '') + '">\
458		                        	<span class="' + (ii==0 ? ' Sunday' : '') + (ii==6 ? ' Saturday' : '') + '">' + opt.weekText[ii] + '</span>\
459		                    	</th>';
460		        }
461		        
462		        template += '</tr>\
463		            	</thead>';
464
465
466		        template += '<tbody>';
467
468	        	var pickerDateTime = '';
469
470
471	        	if(opt.range === false) {
472	        		if(opt.multiSelect === false) {
473	        			if(picker.currentDate) {
474		        			var pickerDate = picker.currentDate;
475		        			var pickerDateArr = pickerDate.split("-");
476		        			var pickerYear = pickerDateArr[0];
477		        			var pickerMonth = pickerDateArr[1];
478		        			var pickerDay = pickerDateArr[2];
479		        			pickerDateTime = new Date(pickerYear, Number(pickerMonth)-1, pickerDay).getTime();
480		        		}
481	        		} else {
482	        			var pickerDateArr = new Array();
483	        			$(picker.currentDateArr).each(function() {
484	        				var pickerDateSplit = this.split("-");
485	        				var pickerYear = pickerDateSplit[0];
486	        				var pickerMonth = pickerDateSplit[1];
487	        				var pickerDay = pickerDateSplit[2];
488	        				pickerDateTime = new Date(pickerYear, Number(pickerMonth)-1, pickerDay).getTime();
489	        				pickerDateArr.push(pickerDateTime);
490	        			});
491	        		}
492	        	} else {
493	        		if(picker.startDate) {
494		        		var pickerStartDate = picker.startDate;
495		        		var pickerStartDateArr = pickerStartDate.split("-");
496		        		var pickerStartYear = pickerStartDateArr[0];
497		        		var pickerStartMonth = pickerStartDateArr[1];
498		        		var pickerStartDay = pickerStartDateArr[2];
499
500		        		var pickerEndDate = picker.endDate;
501		        		var pickerEndDateArr = pickerEndDate.split("-");
502		        		var pickerEndYear = pickerEndDateArr[0];
503		        		var pickerEndMonth = pickerEndDateArr[1];
504		        		var pickerEndDay = pickerEndDateArr[2];
505
506		        		pickerStartDateTime = new Date(pickerStartYear, Number(pickerStartMonth)-1, pickerStartDay).getTime();
507		        		pickerEndDateTime = new Date(pickerEndYear, Number(pickerEndMonth)-1, pickerEndDay).getTime();
508					}
509	        	}
510
511
512
513		        $(dayArr).each(function(key) {
514		        	var tdClass = '';
515		        	var aClass = '';
516		        	if(key == 0 || key % 7 == 0) {
517		        		template += '<tr>';
518		        		tdClass += sundayClass;
519		        	}
520
521		        	if(key % 7 == 6) tdClass += saturdayClass;
522
523		        	
524
525		        	if(this != '') {
526		        		aClass += useableClass;
527						var currentDateTime = new Date(currentYear, currentMonth-1, this).getTime();
528		        		if(opt.range === false) {
529		        			if(opt.multiSelect === false) {
530					        	if(currentDateTime == pickerDateTime) tdClass += activeClass;
531					        } else {
532					        	if(pickerDateArr.indexOf(currentDateTime) > -1) tdClass += activeClass;
533					        }
534				        } else {
535				        	var flag = false;
536				        	if(currentDateTime == pickerStartDateTime) {
537				        		tdClass += activeClass + startClass;
538				        	}
539
540			        		if(currentDateTime > pickerStartDateTime && currentDateTime < pickerEndDateTime) {
541			        			tdClass += activeClass + betweenClass;
542			        		}
543
544				        	if(currentDateTime == pickerEndDateTime) {
545				        		tdClass += activeClass + endClass;
546				        		flag = false;
547				        	}
548				        }
549
550				        if(opt.minDate) {
551				        	if(currentDateTime < minDateTime) {
552				        		tdClass = ' ui-state-disabled ';
553				        		aClass = '';
554				        	}
555				        }
556
557				        if(opt.maxDate) {
558							if(currentDateTime > maxDateTime) {
559								tdClass = ' ui-state-disabled ';
560								aClass = '';
561							}				        	
562				        }
563
564				        if(opt.disabledDays) {
565				        	if($.inArray(currentDateTime, picker.disabledDateTime) > -1) {
566								tdClass = ' ui-state-disabled ';
567								aClass = '';
568				        	}
569				        }
570
571				        if(opt.holidays) {
572				        	if($.inArray(currentDateTime, picker.holidaysDateTime) > -1) {
573								tdClass += ' date-holiday ';
574				        	}
575				        }
576
577				        if(currentDateTime == new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()).getTime()) {
578				        	tdClass += ' ui-datepicker-today ';
579				        }
580
581			        }
582
583
584		        	template += '<td class="' + tdClass + '" data-handler="selectDay" data-event="click" data-month="' + currentMonth + '" data-year="' + currentYear + '" data-day="' + (this < 10 ? '0' + this : this) + '">\
585		                       	 	<a class="' + aClass + '">' + (this != '' ? this : '') + '</a>\
586		                    	</td>';
587
588		        	if(key > 0 && key % 7 == 6) {
589		        		template += '</tr>';
590		        	}
591		        });
592
593		        template += '</tbody>';
594		        template += '</table>'
595		        template += '</div>';
596			}
597
598			if(opt.useTime === true) template += getTimeTemplate();
599
600			return template;
601		},
602
603		getTemplateFoot = function() {
604			var template = '';
605			if(opt.theme == 'duration') {
606				template += '<div class="ui-datepicker-btn"><button type="button" class="btn ui-datepicker-btn-cancel">취소</button> <button type="button" class="btn ui-datepicker-btn-apply">적용</button></div>';
607			}
608
609			template += '</div>';
610			return template;
611		},
612
613
614		getTemplate = function() {
615
616			var template = $("<div>").addClass("uis-datepicker" + (opt.theme ? "-" + opt.theme : "")).addClass("hasDatepicker");
617
618			template.append(getTemplateHead());
619
620			if(opt.theme == 'duration') {
621		        template.find(".ui-datepicker-inline").append(getDurationTemplateBody());	
622		    } else {
623		        template.find(".ui-datepicker-inline").append(getTemplateBody());
624		    }
625   
626			template.append(getTemplateFoot());
627
628			return template;
629		},
630
631		getTimeTemplate = function() {
632			var template = '\
633				<div class="ui-datepicker-time">\
634					<div class="datepicker-timebar datepicker-hour">\
635						<div class="datepicker-timebar-button up" data-value="1">\
636							<svg width="24" height="24" viewBox="0 0 24 24" fill="none">\
637								<path d="M2.70711 15.7071L12.6066 5.80761M21.0919 15.7071L11.1924 5.80761" stroke="black" stroke-width="2"/>\
638							</svg>\
639						</div>\
640						<div style="height: 50px;">\
641							<input type="text" name="" value="' + picker.currentHour + '" class="hour" maxlength="2" />\
642						</div>\
643						<div class="datepicker-timebar-button down" data-value="-1">\
644							<svg width="24" height="24" viewBox="0 0 24 24" fill="none">\
645								<path d="M21.0919 8.29289L11.1924 18.1924M2.70711 8.29289L12.6066 18.1924" stroke="black" stroke-width="2"/>\
646							</svg>\
647						</div>\
648					</div>\
649					<div class="datepicker-timebar-separator">\
650						<div>:</div>\
651					</div>\
652					<div class="datepicker-timebar datepicker-minute">\
653						<div class="datepicker-timebar-button up" data-value="1">\
654							<svg width="24" height="24" viewBox="0 0 24 24" fill="none">\
655								<path d="M2.70711 15.7071L12.6066 5.80761M21.0919 15.7071L11.1924 5.80761" stroke="black" stroke-width="2"/>\
656							</svg>\
657						</div>\
658						<div style="height: 50px;">\
659							<input type="text" name="" value="' + picker.currentMinute + '" class="minute" maxlength="2" />\
660						</div>\
661						<div class="datepicker-timebar-button down" data-value="-1">\
662							<svg width="24" height="24" viewBox="0 0 24 24" fill="none">\
663								<path d="M21.0919 8.29289L11.1924 18.1924M2.70711 8.29289L12.6066 18.1924" stroke="black" stroke-width="2"/>\
664							</svg>\
665						</div>\
666					</div>\
667				</div>\
668			';
669
670			return template;
671		},
672
673		getDateTime = function (dateString) {
674			var dateArr = new Array();
675			var no = getNumber(dateString);
676			dateArr[0] = no.substr(0,4);
677			dateArr[1] = no.substr(4,2);
678			dateArr[2] = no.substr(6,2);
679			return new Date(dateArr[0], dateArr[1], dateArr[2]).getTime();
680		},
681
682		convertDateString = function(datetime) {
683			var date = new Date(datetime);
684			var year = date.getFullYear().toString();
685			var month = (date.getMonth() + 1).toString();
686			var day = date.getDate().toString();
687			if(month < 10) month = '0' + month;
688			if(day < 10) day = '0' + day;
689			return year + '-' + month + '-' + day;
690		},
691
692		getNumber = function (dateString) {
693			var no = dateString.toString().replace(/[^0-9]/g,'');
694			return no;
695		},
696
697		dateFormatting = function (dateString) {
698			if(!dateString) return '';
699			
700			var dateArr = new Array();
701			var no = getNumber(dateString);
702
703
704
705			var yearPos=0;
706			var monthPos=1;
707			var dayPos=2;				
708
709			if(opt.format) {
710				yearPos = opt.format.indexOf('%Y');
711				monthPos = opt.format.indexOf('%m');
712				dayPos = opt.format.indexOf('%d');
713			}
714
715			var formatArr = new Array();
716			if(yearPos > -1) formatArr[yearPos] = 'Y';
717			if(monthPos > -1) formatArr[monthPos] = 'm';
718			if(dayPos > -1) formatArr[dayPos] = 'd';
719
720			var formatStrLen = new Array();
721			formatStrLen['Y'] = 4;
722			formatStrLen['m'] = 2;
723			formatStrLen['d'] = 2;
724
725			var strPos = 0;
726
727			var filterFormatArr = formatArr.filter(function(format) {return format != ''});
728
729			$(filterFormatArr).each(function() {
730				dateArr[this] = no.substr(strPos, formatStrLen[this]);
731				strPos+= formatStrLen[this];
732
733			});
734
735			var returnString = '';
736
737			returnString = dateArr['Y'] + '-' + dateArr['m'] + '-' + dateArr['d'];
738			return returnString;
739		},
740
741		dateCustomFormatting = function (dateString) {
742			if(!dateString) return '';
743			var dateArr = new Array();
744			var no = getNumber(dateString);
745			dateArr[0] = no.substr(0,4);
746			dateArr[1] = no.substr(4,2);
747			dateArr[2] = no.substr(6,2);
748
749			var returnString = '';
750
751			if(opt.format) {
752				returnString = opt.format.replace('%Y', dateArr[0]).replace('%m', dateArr[1]).replace('%d', dateArr[2]);
753			} else {
754				returnString = dateArr[0] + '-' + dateArr[1] + '-' + dateArr[2];
755			}
756
757			return returnString;
758		},
759
760		create = function() {
761			var data = elem.val();
762			if(data) {
763				if(opt.theme == 'duration') {
764					opt.range = true;
765					opt.multiSelect = false;
766					opt.useTime = false;
767				}
768
769				if(opt.range === false) {
770					if(opt.multiSelect === false) {
771						if(opt.useTime === true) {
772							var dataArr = data.split(' ');
773							if(dataArr[1]) {
774								var hourMinute = dataArr[1].split(":");
775								var hour = hourMinute[0];
776								var minute = hourMinute[1];
777							}
778							setHour(hour);
779							setMinute(minute);
780							data = dataArr[0];
781						}
782						setDate(dateFormatting(data));
783					} else {
784						var arr = data.split(",");
785						$(arr).each(function(idx) {
786							setDateArray(dateFormatting(arr[idx]));
787						});
788						
789					}
790				} else {
791					var dataArr = data.split(",");
792					setStartDate(dateFormatting(dataArr[0]));
793					setEndDate(dateFormatting(dataArr[1]));
794				}
795			} else {
796				if(opt.theme == 'duration') {
797					picker.leftDispDate = convertDateString(new Date().getTime());
798					picker.rightDispDate = convertDateString(new Date().getTime());
799				} else {
800					picker.dispDate = convertDateString(new Date().getTime());
801				}
802				if(opt.range === true) {
803					picker.startDate = picker.dispDate;
804					picker.endDate = picker.dispDate;
805				}
806				if(opt.useTime === true) {
807					if(!picker.currentHour) picker.currentHour = 0;
808					if(!picker.currentMinute) picker.currentMinute = 0;
809				}
810			}
811
812			if(opt.monthStep > opt.viewCount) opt.monthStep = opt.viewCount;
813
814			widget = getTemplate();
815
816			if(opt.css) {
817				$.each(opt.css, function(styleName, styleValue) {
818					widget.css(styleName, styleValue);
819				})
820			}
821
822			drawDuration();
823
824			return widget;
825		},
826
827		updateDay = function() {
828
829			if(opt.disabledDays) {
830				picker.disabledDateTime = new Array();
831				$(opt.disabledDays).each(function() {
832					picker.disabledDateTime.push(getDateTime(this));
833				});
834			}
835
836	        if(opt.holidays) {
837	        	picker.holidaysDateTime = new Array();
838	        	$(opt.holidays).each(function() {
839					picker.holidaysDateTime.push(getDateTime(this));
840	        	});
841	        }
842
843	        if(!widget) return;
844
845	        if(opt.theme == 'duration') {
846				widget.find(".ui-datepicker-inline").html(getDurationTemplateBody());
847			} else {
848				widget.find(".ui-datepicker-inline").html(getTemplateBody());
849			}
850
851			if(opt.range === false) {
852				if(opt.multiSelect === true) {
853					widget.find(".ui-state-default").on("click", function() {
854						$(this).closest("td").toggleClass("dp-highlight");
855						setDateArray($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
856					});
857				} else {
858					widget.find(".ui-state-default").on("click", function() {
859						widget.find(".ui-state-default").closest("td").removeClass("dp-highlight");
860						$(this).closest("td").addClass("dp-highlight");
861						setDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
862					});
863				}
864			} else {
865				if(opt.theme == 'duration') {
866					if(opt.theme == 'duration' && $(window).width() < 768) {
867
868						widget.find(".ui-state-default").on("click", function(e) {
869							widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").removeClass("active");
870							if(!picker.startDate) {
871								setStartDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
872								drawDuration();
873							} else if(!picker.endDate) {
874								setEndDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
875								drawDuration();
876							} else {
877								setEndDate('');
878								setStartDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
879								picker.rightDispDate = picker.leftDispDate;
880								drawDuration();
881							}
882						});
883					} else {
884						widget.find(".ui-datepicker-group-left .ui-state-default").on("click", function(e) {
885							widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").removeClass("active");
886							setStartDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
887							drawDuration();
888						});
889
890						widget.find(".ui-datepicker-group-right .ui-state-default").on("click", function(e) {
891							widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").removeClass("active");
892							setEndDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
893							drawDuration();
894						});
895					}
896				} else {
897					widget.find(".ui-state-default").on("click", function(e) {
898						if(!picker.startDate) {
899							setStartDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
900							drawDuration();
901						} else if(!picker.endDate) {
902							setEndDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
903							drawDuration();
904						} else {
905							setEndDate('');
906							setStartDate($(this).closest("td").data("year").toString() + '-' + $(this).closest("td").data("month").toString() + '-' + $(this).closest("td").data("day").toString());
907							drawDuration();
908						}
909					});
910				}
911			}	
912
913			if(opt.theme == 'duration') {
914				widget.find(".ui-datepicker-group-left .ui-datepicker-next").on("click", function() {
915					picker.leftDispDate = convertDateString(new Date(getDateTime(picker.leftDispDate)).setMonth(new Date(getDateTime(picker.leftDispDate)).getMonth()+opt.monthStep));
916					updateDay();
917				});
918
919				widget.find(".ui-datepicker-group-left .ui-datepicker-prev").on("click", function() {
920					picker.leftDispDate = convertDateString(new Date(getDateTime(picker.leftDispDate)).setMonth(new Date(getDateTime(picker.leftDispDate)).getMonth()-opt.monthStep));
921					updateDay();
922				});
923
924				widget.find(".ui-datepicker-group-left .ui-datepicker-next-year").on("click", function() {
925					picker.leftDispDate = convertDateString(new Date(getDateTime(picker.leftDispDate)).setYear(new Date(getDateTime(picker.leftDispDate)).getFullYear()+1));
926					updateDay();
927				});
928
929				widget.find(".ui-datepicker-group-left .ui-datepicker-prev-year").on("click", function() {
930					picker.leftDispDate = convertDateString(new Date(getDateTime(picker.leftDispDate)).setYear(new Date(getDateTime(picker.leftDispDate)).getFullYear()-1));
931					updateDay();
932				});
933
934				widget.find(".ui-datepicker-group-right .ui-datepicker-next").on("click", function() {
935					picker.rightDispDate = convertDateString(new Date(getDateTime(picker.rightDispDate)).setMonth(new Date(getDateTime(picker.rightDispDate)).getMonth()+opt.monthStep));
936					updateDay();
937				});
938
939				widget.find(".ui-datepicker-group-right .ui-datepicker-prev").on("click", function() {
940					picker.rightDispDate = convertDateString(new Date(getDateTime(picker.rightDispDate)).setMonth(new Date(getDateTime(picker.rightDispDate)).getMonth()-opt.monthStep));
941					updateDay();
942				});
943
944				widget.find(".ui-datepicker-group-right .ui-datepicker-next-year").on("click", function() {
945					picker.rightDispDate = convertDateString(new Date(getDateTime(picker.rightDispDate)).setYear(new Date(getDateTime(picker.rightDispDate)).getFullYear()+1));
946					updateDay();
947				});
948
949				widget.find(".ui-datepicker-group-right .ui-datepicker-prev-year").on("click", function() {
950					picker.rightDispDate = convertDateString(new Date(getDateTime(picker.rightDispDate)).setYear(new Date(getDateTime(picker.rightDispDate)).getFullYear()-1));
951					updateDay();
952				});
953			} else {
954				widget.find(".ui-datepicker-next").on("click", function() {
955					picker.dispDate = convertDateString(new Date(getDateTime(picker.dispDate)).setMonth(new Date(getDateTime(picker.dispDate)).getMonth()+opt.monthStep));
956					updateDay();
957				});
958
959				widget.find(".ui-datepicker-prev").on("click", function() {
960					picker.dispDate = convertDateString(new Date(getDateTime(picker.dispDate)).setMonth(new Date(getDateTime(picker.dispDate)).getMonth()-opt.monthStep));
961					updateDay();
962				});
963
964				widget.find(".ui-datepicker-next-year").on("click", function() {
965					picker.dispDate = convertDateString(new Date(getDateTime(picker.dispDate)).setYear(new Date(getDateTime(picker.dispDate)).getFullYear()+1));
966					updateDay();
967				});
968
969				widget.find(".ui-datepicker-prev-year").on("click", function() {
970					picker.dispDate = convertDateString(new Date(getDateTime(picker.dispDate)).setYear(new Date(getDateTime(picker.dispDate)).getFullYear()-1));
971					updateDay();
972				});
973			}
974
975			widget.find(".ui-datepicker-close").on("click", function() {
976				hide();
977			});
978
979			if(opt.useTime === true) {
980				widget.find(".datepicker-hour .datepicker-timebar-button").on("click", function() {
981					if(opt.range === false) {
982						if(!picker.currentHour) picker.currentHour=0;
983						picker.currentHour = Number(picker.currentHour) + Number($(this).data("value"));
984						picker.currentHour = picker.currentHour > 23 ? 0 : (picker.currentHour < 0 ? 23 : picker.currentHour);
985						picker.currentHour = picker.currentHour < 10 ? "0" + picker.currentHour : picker.currentHour;
986						setHour(picker.currentHour);
987						widget.find(".datepicker-hour input.hour").val(picker.currentHour);
988					}
989				});
990
991				widget.find(".datepicker-minute .datepicker-timebar-button").on("click", function() {
992					if(opt.range === false) {
993						if(!picker.currentMinute) picker.currentMinute=0;
994						picker.currentMinute = Number(picker.currentMinute) + Number($(this).data("value"));
995						picker.currentMinute = picker.currentMinute > 59 ? 0 : (picker.currentMinute < 0 ? 59 : picker.currentMinute);
996						picker.currentMinute = picker.currentMinute < 10 ? "0" + picker.currentMinute : picker.currentMinute;
997						setMinute(picker.currentMinute);
998						widget.find(".datepicker-minute input.minute").val(picker.currentMinute);
999					}
1000				});
1001			}
1002
1003
1004			widget.find("[data-handler='selectDay'] .ui-state-default").on("click", function() {
1005				picker.onSelect(opt.onSelect);
1006			});
1007
1008			if(opt.range == true)
1009				drawDuration();
1010		},
1011
1012		show = function() {
1013			var elem_h = elem.outerHeight();
1014			var pos_t = opt.css.top ? opt.css.top : elem.position().top + elem.outerHeight();
1015			var pos_l = opt.css.left ? opt.css.left : elem.position().left;
1016
1017			widget.css({"position": "absolute", "top" : pos_t + "px", "left" : pos_l + "px"});
1018
1019			elem.after(widget);	
1020			updateDay();
1021
1022			if(opt.useTime === true) {
1023				widget.find(".datepicker-hour .hour").on("keyup", function() {
1024					setHour($(this).val());
1025				});
1026
1027				widget.find(".datepicker-minute .minute").on("keyup", function() {
1028					setMinute($(this).val());
1029				});
1030			}
1031
1032
1033			if(widget.offset().left + widget.width() > $(window).width()) {
1034				widget.css("left", "unset").css("right", "0");
1035			}
1036
1037			widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").on("click", function() {
1038				widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").removeClass("active");
1039				$(this).addClass("active");
1040				setEndDate('');
1041				setStartDate('');
1042				setEndDate($(this).data("end_date"));
1043				setStartDate($(this).data("start_date"));
1044				updateDay();
1045				if(typeof opt.onSelect == 'function') {
1046					picker.onSelect(opt.onSelect);
1047				}
1048
1049				if(typeof opt.onDurationSelect == 'function') {
1050					picker.onDurationSelect(opt.onDurationSelect);
1051				}
1052			});
1053
1054			widget.find(".ui-datepicker-btn .ui-datepicker-btn-apply").on("click", function() {
1055				if(opt.onApply) picker.onApply(opt.onApply);
1056				picker.hide();
1057			});
1058
1059			widget.find(".ui-datepicker-btn .ui-datepicker-btn-cancel").on("click", function() {
1060				if(opt.onCancel) picker.onCancel(opt.onCancel);
1061				// picker.hide();
1062			});
1063
1064
1065			if(typeof opt.onShow == 'function') {
1066				picker.onShow(opt.onShow);
1067			}
1068		},
1069
1070		hide = function() {
1071			if(opt.useTime === true) {
1072				if(picker.currentHour.length < 2) {
1073					picker.currentHour = "0" + picker.currentHour;
1074					setHour(picker.currentHour);
1075				}
1076
1077				if(picker.currentMinute.length < 2) {
1078					picker.currentMinute = "0" + picker.currentMinute;
1079					setMinute(picker.currentMinute);
1080				}
1081			}
1082
1083			if(widget.is(":visible")) {
1084				widget.remove();
1085				picker.onHide(opt.onHide);
1086			}
1087		},
1088
1089		setDate = function (newDate) {
1090			// if(!picker.dispDate) picker.dispDate = newDate;
1091			picker.dispDate = newDate;
1092			picker.currentDate = newDate;
1093			setInputValue();
1094		},
1095
1096		getDateTime = function (dateString) {
1097			if(!dateString) return new Date().getTime();
1098			var date = getNumber(dateString);
1099			var year = date.substr(0,4);
1100			var month = date.substr(4,2);
1101			var day = date.substr(6,2);
1102			return new Date(year, Number(month)-1, day).getTime();
1103		},
1104
1105		setStartDate = function (newStartDate) {
1106			if(opt.theme == 'duration') {
1107				if(newStartDate && picker.endDate && getDateTime(newStartDate) > getDateTime(picker.endDate)) {
1108					picker.rightDispDate = newStartDate;
1109					picker.endDate = newStartDate;
1110					// alert($.lang[LANG]['shopping.statistics.startinvalid']);
1111					// return;
1112				}
1113				picker.leftDispDate = newStartDate;
1114			} else {
1115				picker.dispDate = newStartDate;
1116			}
1117			picker.startDate = newStartDate;
1118			if(picker.endDate && getDateTime(picker.startDate) > getDateTime(picker.endDate) && newStartDate) {
1119				var tmpDate = picker.endDate;
1120				setEndDate(picker.startDate);
1121				setStartDate(tmpDate);
1122			}
1123			setInputValue();
1124		},
1125
1126		getStartDateTime = function() {
1127			var startDate = picker.startDate;
1128			if(!picker.startDate) return;
1129			return getDateTime(startDate);
1130		},
1131
1132		setEndDate = function (newEndDate) {
1133			if(opt.theme == 'duration') {
1134				if(newEndDate && picker.startDate && getDateTime(picker.startDate) > getDateTime(newEndDate)) {
1135					picker.leftDispDate = newEndDate;
1136					picker.startDate = newEndDate;
1137					// alert($.lang[LANG]['shopping.statistics.endinvalid']);
1138					// return;
1139				}
1140				picker.rightDispDate = newEndDate;
1141			} else {
1142				picker.dispDate = newEndDate;
1143			}
1144			picker.endDate = newEndDate;
1145			if(picker.startDate && getDateTime(picker.startDate) > getDateTime(picker.endDate) && newEndDate) {
1146				var tmpDate = picker.endDate;
1147				setEndDate(picker.startDate);
1148				setStartDate(tmpDate);
1149			}
1150			setInputValue();
1151		},
1152
1153		getEndDateTime = function() {
1154			var endDate = picker.endDate;
1155			if(!picker.endDate) return;
1156			return getDateTime(endDate);
1157		},
1158
1159		drawDuration = function() {
1160			if(!widget) return;
1161
1162			$(widget).find(".dp-highlight").removeClass("dp-first");
1163
1164			widget.find('.dp-highlight.dp-end').removeClass('dp-highlight').removeClass('dp-end');
1165			widget.find('.dp-highlight.pd-between').removeClass('dp-highlight').removeClass('pd-between');
1166
1167			if(picker.startDate) {
1168				var startDateStr = getNumber(picker.startDate);
1169				widget.find('.dp-highlight').removeClass('dp-highlight');
1170				widget.find('.dp-highlight.dp-first').removeClass('dp-highlight').removeClass('dp-first');
1171				widget.find("td[data-handler='selectDay']").filter(function() {
1172					return $(this).data("year").toString()+$(this).data("month").toString()+$(this).data("day").toString() == startDateStr
1173				}).addClass("dp-highlight").addClass("dp-first");
1174			}
1175
1176			if(picker.endDate) {
1177				var endDateStr = getNumber(picker.endDate);
1178				widget.find('.dp-highlight.dp-end').removeClass('dp-highlight').removeClass('dp-end');
1179				widget.find("td[data-handler='selectDay']").filter(function() {
1180					return $(this).data("year").toString()+$(this).data("month").toString()+$(this).data("day").toString() == endDateStr
1181				}).addClass("dp-highlight").addClass("dp-end");
1182
1183				widget.find('.dp-highlight.pd-between').removeClass('dp-highlight').removeClass('pd-between');
1184				widget.find("td[data-handler='selectDay']").filter(function() {
1185					return $(this).data("year").toString()+$(this).data("month").toString()+$(this).data("day").toString() > startDateStr && $(this).data("year").toString()+$(this).data("month").toString()+$(this).data("day").toString() < endDateStr
1186				}).addClass("dp-highlight").addClass("pd-between");
1187			}
1188
1189			if(opt.theme == 'duration') {
1190				widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item").removeClass("active");
1191				widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item[data-start_date='" + picker.startDate + "'][data-end_date='" + picker.endDate + "']").addClass("active");
1192				if(widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item[data-start_date='" + picker.startDate + "'][data-end_date='" + picker.endDate + "']:first").length) {
1193					picker.durationText = widget.find(".ui-datepicker-selectduration .ui-datepicker-selectduration-item[data-start_date='" + picker.startDate + "'][data-end_date='" + picker.endDate + "']:first").html();
1194				} else {
1195					if(!picker.getEndDate()) picker.durationText = 1 + $.lang[LANG]['shopping.statistics.datepicker.day'];
1196					else picker.durationText = Math.abs((getDateTime(picker.startDate) - getDateTime(picker.endDate)) / 86400000) + 1 + $.lang[LANG]['shopping.statistics.datepicker.day'];
1197				}
1198			}
1199		},
1200
1201		setDateArray = function(newDate) {
1202			if(!picker.dispDate) picker.dispDate = newDate;
1203			if(!picker.currentDateArr) picker.currentDateArr = new Array();
1204
1205			if($.inArray(newDate, picker.currentDateArr) > -1) {
1206				picker.currentDateArr.splice($.inArray(newDate, picker.currentDateArr), 1);
1207			} else {
1208				if(opt.minDate && getDateTime(newDate) < getDateTime(opt.minDate)) {
1209					picker.currentDateArr.splice($.inArray(newDate, picker.currentDateArr), 1);
1210				} else if(opt.maxDate && getDateTime(newDate) > getDateTime(opt.maxDate)) {
1211					picker.currentDateArr.splice($.inArray(newDate, picker.currentDateArr), 1);
1212				} else {
1213					picker.currentDateArr.push(newDate);
1214				}
1215			}
1216			picker.currentDateArr.sort();
1217			setInputValue();
1218		},
1219
1220		checkDateArray = function () {
1221			var dateArray = new Array();
1222			
1223			$(picker.currentDateArr).each(function(idx) {
1224				if(opt.minDate && getDateTime(picker.currentDateArr[idx]) < getDateTime(opt.minDate)) {
1225					
1226				} else if(opt.maxDate && getDateTime(picker.currentDateArr[idx]) > getDateTime(opt.maxDate)) {
1227					
1228				} else {
1229					dateArray.push(picker.currentDateArr[idx]);
1230				}
1231			});
1232			picker.currentDateArr = new Array();
1233			picker.currentDateArr = dateArray;
1234			setInputValue();
1235		},
1236
1237		setHour = function(newHour) {
1238			newHour = getNumber(newHour);
1239			if(!newHour) newHour = '00';
1240			if(newHour > 23 || newHour <0) newHour = '00';
1241			picker.currentHour = newHour;
1242			setInputValue();
1243		},
1244
1245		setMinute = function(newMinute) {
1246			newMinute = getNumber(newMinute);
1247			if(!newMinute) newMinute = '00';
1248			if(newMinute > 59 || newMinute <0) newMinute = '00';
1249			picker.currentMinute = newMinute;
1250			setInputValue();
1251		},
1252
1253		setInputValue = function() {
1254			var returnValue = '';
1255			if(opt.range === false) {
1256				if(opt.multiSelect === false) {
1257					returnValue = dateCustomFormatting(picker.currentDate);	
1258					if(opt.useTime === true) {
1259						returnValue += ' ' + picker.currentHour + ':' + picker.currentMinute;
1260						if(widget) widget.find(".datepicker-hour .hour").val(picker.currentHour);
1261						if(widget) widget.find(".datepicker-minute .minute").val(picker.currentMinute);
1262					}
1263				} else {
1264					returnValue = picker.currentDateArr.join(',');
1265				}
1266			} else {
1267				returnValue = dateCustomFormatting(picker.startDate) + ',' + dateCustomFormatting(picker.endDate);
1268			}
1269
1270			elem.val(returnValue);
1271		};
1272
1273		picker.show = function() {
1274			if(!widget) create();
1275			show();
1276		};
1277
1278		picker.hide = function() {
1279			hide();
1280		};
1281
1282		picker.setHolidays = function(holidays) {
1283			opt.holidays = holidays;
1284			updateDay();
1285		};
1286
1287		picker.setMinDate = function(minDate) {
1288			opt.minDate = minDate;
1289			checkDateArray();
1290			updateDay();
1291		};
1292
1293		picker.refresh = function() {
1294			hide();
1295			widget = null;
1296			picker.startDate = '';
1297			picker.endDate = '';
1298			create();
1299			show();
1300		};
1301
1302		picker.getMinDate = function() {
1303			return opt.minDate;
1304		};
1305
1306		picker.setMaxDate = function(maxDate) {
1307			opt.maxDate = maxDate;
1308			checkDateArray();
1309			updateDay();
1310		};
1311
1312		picker.getMaxDate = function() {
1313			return opt.maxDate;
1314		}
1315
1316		picker.setDisabledDays = function(disabledDays) {
1317			opt.disabledDays = disabledDays;
1318			updateDay();
1319		};
1320
1321		picker.setViewCount = function(viewCount) {
1322			opt.viewCount = viewCount;
1323			if(widget) {
1324				widget.find(".ui-datepicker-inline, .ui-datepicker-close").remove();
1325				widget.append(getTemplateHead());
1326				updateDay();
1327			}
1328		};
1329
1330		picker.onSelect = function(callback) {
1331			if(typeof callback == 'function') {
1332				callback(picker);
1333			}
1334		};
1335
1336		picker.onDurationSelect = function(callback) {
1337			if(typeof callback == 'function') {
1338				callback(picker);
1339			}
1340		};
1341
1342		picker.onShow = function(callback) {
1343			if(typeof callback == 'function') {
1344				callback(picker);
1345			}
1346		};
1347
1348		picker.onHide = function(callback) {
1349			if(typeof callback == 'function') {
1350				callback(picker);
1351			}
1352		};
1353
1354		picker.onApply = function(callback) {
1355			if(typeof callback == 'function') {
1356				callback(picker);
1357			}
1358		};
1359
1360		picker.onCancel = function(callback) {
1361			if(typeof callback == 'function') {
1362				callback(picker);
1363			}
1364		}
1365
1366		picker.getOpt = function() {
1367			return opt;
1368		};
1369
1370
1371		elem.prop("readonly", true);
1372		elem.on("focus", function(){
1373			if(!widget) create();
1374			show();
1375		});
1376
1377		if(opt.autoHide !== false) {
1378			$(document).on("mousedown", function(e) {
1379				if(widget) {
1380					var container = widget;
1381					if (!container.is(e.target) && container.has(e.target).length === 0 && !elem.is(e.target) && elem.has(e.target).length === 0) {
1382						hide();
1383					}
1384				}
1385			});
1386		}
1387
1388		if(opt.range === true) {
1389			picker.setStartDate = function(newStartDate) {
1390				setStartDate(newStartDate);
1391				updateDay();
1392			};
1393
1394			picker.setEndDate = function(newEndDate) {
1395				setEndDate(newEndDate);
1396				updateDay();
1397			};
1398
1399			picker.getStartDate = function() {
1400				return dateCustomFormatting(picker.startDate);
1401			}
1402
1403			picker.getEndDate = function() {
1404				return dateCustomFormatting(picker.endDate);
1405			};
1406
1407			picker.getDateArray = function() {
1408				var dateArr = new Array();
1409				if(picker.startDate && picker.endDate) {
1410
1411					var startDateTime = getDateTime(picker.startDate);
1412					var endDateTime = getDateTime(picker.endDate);
1413
1414					while(startDateTime <= endDateTime) {
1415						var currentDate = new Date(startDateTime);
1416						var year = currentDate.getFullYear();
1417						var month = currentDate.getMonth()+1;
1418						var day = currentDate.getDate();
1419						if(month < 10) month = '0'+month;
1420						if(day < 10) day = '0'+day;
1421						dateArr.push(dateCustomFormatting(year + '-' + month + '-' + day));
1422						startDateTime += 86400000;
1423					}
1424				}
1425				return dateArr;
1426			};
1427		} else {
1428			if(opt.multiSelect === false) {
1429				picker.setDate = function(newDate) {
1430					setDate(newDate);
1431					updateDay();
1432				};
1433
1434				picker.getDate = function() {
1435					return picker.currentDate;
1436				};
1437			} else {
1438				picker.setDateArray = function(newDateArray) {
1439					picker.currentDateArr = new Array();
1440					$(newDateArray).each(function() {
1441						setDateArray(this);
1442					});
1443					updateDay();
1444				};
1445
1446				picker.getDateArray = function() {
1447					var returnDateArr = new Array();
1448					$(picker.currentDateArr).each(function() {
1449						returnDateArr.push(dateCustomFormatting(this));
1450					});
1451					return returnDateArr;
1452				};
1453			}
1454		}
1455
1456		if(opt.useTime === true) {
1457			picker.setHour = function(newHour) {
1458				setHour(newHour);
1459				updateDay();
1460			};
1461
1462			picker.getHour = function() {
1463				return picker.currentHour;
1464			};
1465
1466			picker.setMinute = function(newMinute) {
1467				setMinute(newMinute);
1468				updateDay();
1469			};
1470
1471			picker.getMinute = function() {
1472				return picker.currentMinute;
1473			};
1474		}
1475
1476		picker.setOpt = function(newOpt) {
1477			hide();
1478			widget = null;
1479			newOpt = $.extend(true, {}, opt, newOpt);
1480			var $this = $(elem);
1481			$this.data('DatePicker', null);
1482			$this.data('DatePicker', datepicker($this, newOpt));
1483			create();
1484		};
1485
1486		widget = create();
1487
1488		return picker;
1489	}
1490
1491
1492	$.fn.datepicker = function(opt) {
1493	    return this.each(function () {
1494	        var $this = $(this);
1495	            // create a private copy of the defaults object
1496
1497	        if (!$this.data('DatePicker')) {
1498				opt = $.extend(true, {}, $.fn.datepicker.defaults, opt);
1499				$this.data('DatePicker', datepicker($this, opt));
1500			}
1501	    });
1502	};
1503	var week_lang = {'ko' : ['일', '월', '화', '수' ,'목', '금', '토'], 'en' : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] };
1504
1505	$.fn.datepicker.defaults = {
1506		minDate : false,
1507		maxDate : false,
1508		disabledDays: false,
1509		format : '%Y-%m-%d',
1510		useTime : false,
1511		range : false,
1512		multiSelect : false,
1513		viewCount : 1,
1514		weekText : LANG ? week_lang[LANG] : week_lang['ko'],
1515		width : false, // default: 486
1516		holidays : false,
1517		prevText : '<svg viewBox="0 0 14 14" width="14" height="14"><polygon points="9 1 10 2 5 7 10 12 9 13 3 7 "/></svg>',
1518		nextText : '<svg viewBox="0 0 14 14" width="14" height="14"><polygon points="5 1 4 2 9 7 4 12 5 13 11 7 "/></svg>',
1519		prevYearText : '<svg viewBox="0 0 14 14" width="14" height="14"><polygon points="8 2 7 1 1 7 7 13 8 12 3 7 "/><polygon points="13 2 12 1 6 7 12 13 13 12 8 7 "/></svg>',
1520		nextYearText : '<svg viewBox="0 0 14 14" width="14" height="14"><polygon points="7 1 6 2 11 7 6 12 7 13 13 7 "/><polygon points="2 1 1 2 6 7 1 12 2 13 8 7 "/></svg>',
1521		monthStep: 1,
1522		showClose: false,
1523		theme : false,
1524		css : {},
1525		autoHide : true,
1526	}
1527
1528})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.