datepicker 가 내장된 브라우저에서는 내장 기능 사용

This commit is contained in:
MinSoo Kim 2016-02-23 04:13:14 +09:00
parent 81b1fd5752
commit c9ed1f08e9
7 changed files with 213 additions and 35 deletions

View file

@ -66,16 +66,33 @@ jQuery(function($){
});
});
(function($){
$(function(){
var option = { changeMonth: true, changeYear: true, gotoCurrent: false,yearRange:'-100:+10', dateFormat:'yy-mm-dd', onSelect:function(){
$(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))}
};
$.extend(option,$.datepicker.regional['{$lang_type}']);
$(".inputDate").datepicker(option);
$(function(){
// check if the browser support type date.
if ( $(".inputDate").prop('type') != 'date' ) {
var option = {
changeMonth: true,
changeYear: true,
gotoCurrent: false,
yearRange:'-200:+10',
dateFormat:'yy-mm-dd',
defaultDate: new Date("{date('Y-m-d',time())}"),
minDate: new Date("{date('Y-m-d',strtotime('-200 years'))}"),
onSelect:function(){
$(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))
}
};
$.extend($.datepicker.regional['{$lang_type}'],option);
//if the browser does not support type date input, start datepicker. If it does, brower's UI will show their datepicker.
$(".inputDate").datepicker(option);
} else {
$(".inputDate").prop('readonly', false);
}
$(".dateRemover").click(function() {
$(this).prevAll('input').val('');
return false;});
});
});
})(jQuery);
</script>
<include target="./common_footer.html" />