public static function SmartDateTrait::isAllDay in Smart Date 3.4.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.3.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.
9 calls to SmartDateTrait::isAllDay()
- SmartDateDailyRangeFormatter::viewElements in modules/
smart_date_recur/ src/ Plugin/ Field/ FieldFormatter/ SmartDateDailyRangeFormatter.php - 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.
- SmartDateRecurrenceFormatter::augmentOutput in modules/
smart_date_recur/ src/ Plugin/ Field/ FieldFormatter/ SmartDateRecurrenceFormatter.php - Apply any configured augmenters.
- SmartDateRule::getTextRule in modules/
smart_date_recur/ src/ Entity/ SmartDateRule.php - Use the transformer to get text output of the rule.
File
- src/
SmartDateTrait.php, line 685
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;
}