PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
← All changes | app/Services/DateTimeHelper.php +6 -14 1.10.01 → 2.5.0 View file →
@@ -174,14 +174,14 @@
174 174
175 175 public static function formatToLocale($dateTime, $for = 'date')
176 176 {
177 177 // $for can be date | date_time | time
178 - $dateFormat = get_option('date_format');
178 + $dateFormat = (string) get_option('date_format', '');
179 179
180 180 if ($for == 'date_time') {
181 - $dateFormat .= ' ' . get_option('time_format');
181 + $dateFormat .= ' ' . (string) get_option('time_format', '');
182 182 } elseif ($for == 'time') {
183 - $dateFormat = get_option('time_format');
183 + $dateFormat = (string) get_option('time_format', '');
184 184 }
185 185
186 186 return date_i18n($dateFormat, strtotime($dateTime)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
187 187 }
@@ -188,9 +188,9 @@
188 188
189 189 public static function getFormattedDate($date, $from = '', $to = 'Y-m-d')
190 190 {
191 191 if (!$from) {
192 - $from = get_option('date_format');
192 + $from = (string) get_option('date_format', '');
193 193 }
194 194
195 195 $date = \DateTime::createFromFormat($from, $date);
196 196 return $date ? $date->format($to) : '';
@@ -296,22 +296,14 @@
296 296
297 297 for ($i = 0; $i < strlen($phpFormat); $i++) {
298 298 $char = $phpFormat[$i];
299 299
300 - // Special handling for G\hi pattern
301 - if ($char === 'G' && $i + 2 < strlen($phpFormat) &&
302 - $phpFormat[$i + 1] === '\\' && $phpFormat[$i + 2] === 'h') {
303 - $dayjsFormat .= 'H[h]';
304 - $i += 2;
305 - continue;
306 - }
307 -
308 300 // Check if the character is escaped
309 301 if ($char === "\\") {
310 - // Add the next character to the result as is, without mapping
302 + // Day.js escapes literal text with square brackets, not backslashes
311 303 $i++;
312 304 if ($i < strlen($phpFormat)) {
313 - $dayjsFormat .= "\\" . $phpFormat[$i];
305 + $dayjsFormat .= "[" . $phpFormat[$i] . "]";
314 306 }
315 307 continue;
316 308 }
317 309