From e7b40b853365b5bb82966d09dca67c94b4a47d95 Mon Sep 17 00:00:00 2001 From: Pppery Date: Mon, 09 Feb 2026 02:58:52 +0000 Subject: [PATCH] Allow editing event dates in languages which translate "AM"/"PM" Summary: Fixes the bug in the third paragraph of D25861#39133 Depends on D25861 Test Plan: Follow the test plan setup for D25861. Try to edit an event and see that you can now edit it normally and don't get "end date is invalid"/"start date is invalid" errors. Reviewers: aklapper, O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Differential Revision: https://we.phorge.it/D26544 --- src/view/form/control/AphrontFormDateControlValue.php | 10 +++++++++- 1 file(s) changed, 9 insertion(s)(+), 1 deletion(s)(-) diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php --- a/src/view/form/control/AphrontFormDateControlValue.php +++ b/src/view/form/control/AphrontFormDateControlValue.php @@ -369,7 +369,15 @@ if (isset($colloquial[$normalized])) { $time = $colloquial[$normalized]; } - + // Convert localized times to English + $am = pht('AM'); + if ($am !== 'AM') { + $time = preg_replace('/'.preg_quote($am).'$/', 'AM', $time); + } + $pm = pht('PM'); + if ($pm !== 'PM') { + $time = preg_replace('/'.preg_quote($pm).'$/', 'PM', $time); + } return $time; } -- tangled.sh