Datepicker: Fix localization demo

This commit is contained in:
Felix Nagel 2014-06-18 02:05:42 +02:00 committed by Scott González
parent fd3a68cfa3
commit 40e8519437
2 changed files with 16 additions and 9 deletions

View File

@ -16,12 +16,15 @@
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var calendar = $( "#calendar" ).calendar(),
date = calendar.calendar( "valueAsDate" );
var calendar = $( "#calendar" ),
select = $( "#locale" );
$( "#locale" ).change( function() {
Globalize.locale( select.val() );
calendar.calendar();
select.change( function() {
Globalize.locale( $( this ).val() );
calendar.calendar( "valueAsDate", date );
calendar.calendar( "valueAsDate", calendar.calendar( "valueAsDate" ) );
});
});
</script>

View File

@ -17,11 +17,15 @@
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
Globalize.locale( "de-DE" );
$( "#datepicker" ).datepicker();
$( "#locale" ).change(function() {
// TODO refresh the current value to convert to the selected locale
Globalize.locale( $(this).val() );
var datepicker = $( "#datepicker" ),
select = $( "#locale" );
Globalize.locale( select.val() );
datepicker.datepicker();
select.change( function() {
Globalize.locale( $( this ).val() );
datepicker.datepicker( "valueAsDate", datepicker.datepicker( "valueAsDate" ) );
});
});
</script>