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 +++------ tests/Select.spec.jsx | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) 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); } } diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx index fb58145..ea0a827 100644 --- a/tests/Select.spec.jsx +++ b/tests/Select.spec.jsx @@ -446,7 +446,7 @@ describe('Select', () => { Simulate.click(selector.getElementsByTagName('li')[0]); setTimeout(next, 200); }, (next) => { - expect((input).value).to.be('12:00 pm'); + expect((input).value).to.be('12:00 am'); next(); }], () => { done(); -- cgit v1.2.3