studioespresso / craft-date-range

Date range field for Craft CMS
MIT License
12 stars 6 forks source link

Undefined variable: dateFormat #20

Closed carolineboeykens closed 4 years ago

carolineboeykens commented 4 years ago

Error in vendor/studioespresso/craft-date-range/src/fields/data/DateRangeData.php line 67

if ($this->start->format('dmy') === $this->end->format('dmy') && isset($timeFormat)) { $string .= $formatter->asDate($this->start, "php:$dateFormat"); $string .= " "; $string .= $formatter->asTime($this->start, "php:$timeFormat"); $string .= " " . trim($seperator) . " "; $string .= $formatter->asTime($this->end, "php:$timeFormat"); } else { $string .= $formatter->asDate($this->start, "php:$dateFormat"); $string .= " " . trim($seperator) . " "; $string .= $formatter->asDate($this->start, "php:$dateFormat"); }

$dateFormat should be $format and on the last line: $this->start should be $this->end

if ($this->start->format('dmy') === $this->end->format('dmy') && isset($timeFormat)) { $string .= $formatter->asDate($this->start, "php:$format"); $string .= " "; $string .= $formatter->asTime($this->start, "php:$format"); $string .= " " . trim($seperator) . " "; $string .= $formatter->asTime($this->end, "php:$format"); } else { $string .= $formatter->asDate($this->start, "php:$format"); $string .= " " . trim($seperator) . " "; $string .= $formatter->asDate($this->end, "php:$format"); }

janhenckens commented 4 years ago

Fixed in 2.1.2!