public static function SmartDateTrait::isAllDay in Smart Date 3.3.x
Same name and namespace in other branches
- 8.2 src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
- 3.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
- 3.0.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
- 3.1.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
- 3.2.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
- 3.4.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::isAllDay()
Evaluates whether or not a provided range is "all day".
Parameters
object $start_ts: A timestamp.
object $end_ts: A timestamp.
string|null $timezone: An optional timezone override.
Return value
bool Whether or not the timestamps are considered all day by Smart Date.
6 calls to SmartDateTrait::isAllDay()
- SmartDateDurationFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ SmartDateDurationFormatter.php - SmartDateProcessor::updateEntry in src/
Plugin/ FullcalendarViewProcessor/ SmartDateProcessor.php - Helper function to update the FCV-created data arrary.
- SmartDateRule::getTextRule in modules/
smart_date_recur/ src/ Entity/ SmartDateRule.php - Use the transformer to get text output of the rule.
- SmartDateTrait::addTimeWrapper in src/
SmartDateTrait.php - Add spans provides classes to allow the dates and times to be styled.
- SmartDateTrait::formatSmartDate in src/
SmartDateTrait.php - Creates a formatted date value as a string.
File
- src/
SmartDateTrait.php, line 607
Class
- SmartDateTrait
- Provides friendly methods for smart date range.
Namespace
Drupal\smart_dateCode
public static function isAllDay($start_ts, $end_ts, $timezone = NULL) {
if ($timezone) {
// Apply a specific timezone provided.
$default_tz = date_default_timezone_get();
date_default_timezone_set($timezone);
}
// Format timestamps to predictable format for comparison.
$temp_start = date('H:i', $start_ts);
$temp_end = date('H:i', $end_ts);
if ($timezone) {
// Revert to previous timezone.
date_default_timezone_set($default_tz);
}
if ($temp_start == '00:00' && $temp_end == '23:59') {
return TRUE;
}
return FALSE;
}