| @@ -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 | |