From 535fd0c3fd8bf7793e96b5efa18e53f6773d4d87 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 25 Nov 2021 15:10:58 +0100 Subject: [PATCH 1/6] DateTimePicker: Extract `from12hTo24h` function --- packages/components/src/date-time/time.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/components/src/date-time/time.js b/packages/components/src/date-time/time.js index 9063a6011a335..fc76b98edd827 100644 --- a/packages/components/src/date-time/time.js +++ b/packages/components/src/date-time/time.js @@ -28,6 +28,10 @@ import TimeZone from './timezone'; */ const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss'; +function from12hTo24h( hours, isPm ) { + return isPm ? ( ( hours % 12 ) + 12 ) % 24 : hours % 12; +} + /** * * A shared component to parse, validate, and handle remounting of the underlying form field element like and