may I ask why No updates since 2018 ?
]]>I created a filter gravityforms_only_start_end_time’ – If true will filter hours to only hours set in
gravityforms_business_hours_default_start_time – Default start time in H:i format (default: 09:00)
gravityforms_business_hours_default_end_time – Default end time in H:i format (default: 18:00)
Or default hours if not set.
I made changes to the function gf_business_hours_get_times(), located in helper-functions.php
/**
* Generate array of times with key in <code>H:i</code> format and after-midnight in <code>+H:i</code> format
*
* @since 2.0
*
* @param boolean $with_after_midnight Include times for next day
*
* @return array Array of times, with keys as <code>H:i</code>-formatted time, and values as <code>g:i a</code> formatted time
* Added option of $only_start_end_time. - Ira Rabinowitz [email protected]
*/
function gf_business_hours_get_times( $with_after_midnight = false) {
$key_format = 'H:i';
/**
* Modify the time format for the displayed value
* @param string
*/
$value_format = apply_filters( 'gravityforms_business_hours_time_format', 'g:i a' );
$only_start_end_time = apply_filters( 'gravityforms_only_start_end_time', false);
/**
* Time interval for the time dropdown options
* @var int
*/
$interval_minutes = apply_filters( 'gravityforms_business_hours_interval', 30 );
$interval_minutes = intval( $interval_minutes );
$interval = new DateInterval('PT'.$interval_minutes.'M');
if ($only_start_end_time) {
$starttime = apply_filters('gravityforms_business_hours_default_start_time','00:00');
$endtime = apply_filters('gravityforms_business_hours_default_end_time','00:00');
$endingtime = new DateTime( $endtime );
$endingtime->add($interval);
$tempendtime = $endingtime->format($key_format);
$with_after_midnight = false;
} else {
$starttime = '00:00';
}
$time = new DateTime( $starttime );
$temptime = '';
$times = array();
do {
$key = $time->format( $key_format );
// 12:30 am
$value = $time->format( $value_format );
$times[ $key ] = $value;
// Increase by 30 minute intervals
$time->add($interval);
$temptime = $time->format( $key_format );
} while( $temptime !== ($only_start_end_time ? $tempendtime : $starttime ));
// Build additional times for the next day closing times
if( $with_after_midnight ) {
$next_day = __('next day', 'gravity-forms-business-hours');
foreach( $times as $key => $time ) {
$times[ '+'.$key ] = sprintf( '%s (%s)', $time, $next_day );
// Only show "Next day" times until 7am
if( $key === '07:00' ) {
break;
}
}
}
return $times;
}
]]>
That’s all.
https://www.ads-software.com/plugins/gravity-forms-business-hours/
]]>I have version 1.7.9 of Gravity Forms. I installed the Business hours plugin but the selection does not show under advanced fields. No errors during install and activation. What could be the problem?
https://www.ads-software.com/plugins/gravity-forms-business-hours/
]]>No support will be provided here.
If you are a GravityView customer, you can request support on the GravityView Support page.
https://www.ads-software.com/plugins/gravity-forms-business-hours/
]]>