From 33906cadca91f496ac034e797be9b4ec32e2e038 Mon Sep 17 00:00:00 2001 From: Melloware Date: Wed, 10 Jan 2024 13:35:43 -0500 Subject: [PATCH] Fix #5719: Calendar paste 12:01 AM (#5731) --- components/doc/button/linkdoc.js | 8 ++--- components/doc/calendar/icondoc.js | 48 ++++++++++++++--------------- components/doc/panel/templatedoc.js | 12 ++++---- components/doc/ripple/customdoc.js | 24 +++++++-------- components/doc/toolbar/customdoc.js | 12 ++++---- components/lib/calendar/Calendar.js | 10 ++++-- 6 files changed, 60 insertions(+), 54 deletions(-) diff --git a/components/doc/button/linkdoc.js b/components/doc/button/linkdoc.js index 5004fc8fe5..c9353fbd7f 100644 --- a/components/doc/button/linkdoc.js +++ b/components/doc/button/linkdoc.js @@ -6,7 +6,7 @@ export function LinkDoc(props) { const code = { basic: ` {options.togglerElement} @@ -107,8 +107,8 @@ export default function TemplateDemo() {
- {options.togglerElement}
@@ -178,8 +178,8 @@ export default function TemplateDemo() {
- {options.togglerElement}
diff --git a/components/doc/ripple/customdoc.js b/components/doc/ripple/customdoc.js index b0b81cdd6d..12c4f7ddc7 100644 --- a/components/doc/ripple/customdoc.js +++ b/components/doc/ripple/customdoc.js @@ -5,7 +5,7 @@ import { Ripple } from '@/components/lib/ripple/Ripple'; export function CustomDoc(props) { const code = { basic: ` -
+
Green
-
+
Orange
-
+
Purple -
+
Green
-
+
Orange
-
+
Purple -
+
Green
-
+
Orange
-
+
Purple
-
+
Green
-
+
Orange
-
+
Purple -
+
- Amy Elsner + Amy Elsner
); @@ -104,9 +104,9 @@ export default function CustomDemo() { const endContent = ( -
+
- Amy Elsner + Amy Elsner
); @@ -165,9 +165,9 @@ export default function CustomDemo() { const endContent = ( -
+
- Amy Elsner + Amy Elsner
); diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 178e2954e2..148fe65aa0 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -2310,8 +2310,14 @@ export const Calendar = React.memo( if (isNaN(h) || isNaN(m) || h > 23 || m > 59 || (props.hourFormat === '12' && h > 12) || (props.showSeconds && (isNaN(s) || s > 59)) || (props.showMillisec && (isNaN(s) || s > 1000))) { throw new Error('Invalid time'); } else { - if (props.hourFormat === '12' && h !== 12 && ampm === 'PM') { - h += 12; + if (props.hourFormat === '12') { + if (h !== 12 && ampm === 'PM') { + h += 12; + } + + if (h === 12 && ampm === 'AM') { + h -= 12; + } } return { hour: h, minute: m, second: s, millisecond: ms };