Este nuevo plugin es un selector de fecha.
El selector de fecha de PHPRunner tiene muchas posibilidades y es muy fácil de configurar, pero…… le falta la gestión de días festivos (no seleccionables) y esto es principalmente lo que aporta este plugin.
Está disponible en la página de plugines.
En la demo se ha configurado con:
// The days of the week are: 0 (Sunday) to 6 (Saturday) $this->settings["required"] = false; // Wether is mandatory $this->settings["tooltip"] = 'Enter the date of ......'; // Tooltip of field $this->settings["format"] = 'mm/dd/yyyy'; // Format of presentation of the date $this->settings["weekStart"] = '0'; // Day in which the week begins $this->settings["startDate"] = '02/01/2021'; // Selectable initil date. The defined date format must be used $this->settings["endDate"] = '05/31/2021'; // Selectable end date. The defined date format must be used $this->settings["todayBtn"] = true; // So that "today" button appears $this->settings["clearBtn"] = true; // So that "clean" button appears $this->settings["daysOfWeekDisabled"] = "0,6"; // Days of the week I do not work $this->settings["daysOfWeekHighlighted"] = "0,6"; // Days of the week highlighted $this->settings["calendarWeeks"] = true ; // If in the calendar you show the information number $this->settings["autoclose"] = true ; // If when selecting a date, the calendar window is closed $this->settings["todayHighlight"] = true ; // If the current day is highlighted $this->settings["language"] = 'en-GB' ; // Calendar language. Consult URL: https://github.com/uxsolutions/bootstrap-datepicker/tree/master/dist/locales $this->settings["datesDisabled"] = array('03/03/2021', '03/24/2021','04/07/2021','04/21/2021'); // Holidays Array of days is defined according to the format that has been specified.
Por defecto, el campo de base de datos es de tipo «varchar». Para poner de tipo «date» o «datetime», debemos programar los siguientes eventos:
Before record updates | added
$format = 'm/d/Y'; if ( $values['datePicker'] <>'') { $date_a = DateTime::createFromFormat($format,$values['datePicker']); $values['datePicker'] = $date_a->format('Y-m-d'); } else { $values['datePicker'] = NULL; } return true;
En «EDIT pages» en el evento Process record values
$format = 'm/d/Y'; if ( $values['datePicker'] <> NULL ) { $values['datePicker'] = date($format, strtotime($values['datePicker'])); } else { $values['datePicker'] = ''; }