Problem with regional JQuery datepicker ?
-
Hi,
One of my plugin load the JQuery regional (FR) datepicker
jquery.ui.datepicker-fr.js?ver=1.11.1
and for some reason it makes problem with the plugin.What happen is that the date & time of the event becomes the current date & time during the creation process, so that the event is seen as a past event.
I notice this after I add these few lines in the archive loop :
$meta = get_post_meta($post->ID ); echo date('d F Y H i', $meta['event-unix'][0]); </br> <?php echo current_time( 'mysql' );
As soon as I remove the file
jquery.ui.datepicker-fr.js
the new event created appear as upcoming… but the datepicker remains in english.jQuery(function($){ $.datepicker.regional['fr'] = { closeText: 'Fermer', prevText: 'Précédent', nextText: 'Suivant', currentText: 'Aujourd \'hui', monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', 'Juillet','Ao?t','Septembre','Octobre','Novembre','Décembre'], monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin', 'Juil.','Ao?t','Sept.','Oct.','Nov.','Déc.'], dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'], dayNamesMin: ['D','L','M','M','J','V','S'], weekHeader: 'Sem.', dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['fr']); });
I’ve try to modify this JS file in order to match with the original JQuery file that as a different
dateFormat
andfirstDay
or replacing with regional file from JQuery website but still the same and it is not clear for me what can cause this between the two.It looks like
$event_unix
in$event_unix = get_post_meta( $post_id, 'event-unix', true );
returns empty value which cause $timestamp to be equal to current time.private function save_timestamp() { $date_flag = false; $date = date_parse( $this->date ); if( $date["error_count"] == 0 && checkdate( $date["month"], $date["day"], $date["year"] ) ) $date_flag = true; $time_flag = false; $time = date_parse( $this->time ); if( $time["error_count"] == 0 ) $time_flag = true; if( $date_flag && $time_flag ) { $date_time = $this->date . ' ' . $this->time; $timestamp = strtotime( $date_time ); } elseif( $date_flag ) { $timestamp = strtotime( $this->date ); } else { $event_unix = get_post_meta( $post_id, 'event-unix', true ); if( ! empty( $event_unix ) ) { $timestamp = $event_unix; } else $timestamp = current_time( 'timestamp' ); } update_post_meta( $this->post_id, 'event-unix', $timestamp ); }
Did you already have this plugin working with JQuery datepickers for others regions ?
- The topic ‘Problem with regional JQuery datepicker ?’ is closed to new replies.