From 2a8cf5ae98a8b827e62aa20212053de6171315c9 Mon Sep 17 00:00:00 2001 From: Antony Shaleynikov Date: Thu, 2 Mar 2017 16:36:33 +0300 Subject: Tests and 12PM -> 12AM switching fixed --- src/Combobox.jsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Combobox.jsx b/src/Combobox.jsx index d2c934c..958e108 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx @@ -56,15 +56,12 @@ const Combobox = React.createClass({ value.minute(+itemValue); } else if (type === 'ampm') { if (use12Hours) { - if (itemValue === 'PM' && value.hour() <= 12) { - value.hour(value.hour() + 12); + if (itemValue === 'PM' && value.hour() < 12) { + value.hour((value.hour() % 12) + 12); } if (itemValue === 'AM') { - if (!value.hour()) { - value.hour(12); - } else - if (value.hour() > 12) { + if (value.hour() >= 12) { value.hour(value.hour() - 12); } } -- cgit v1.2.3