This is an automated email from the ASF dual-hosted git repository.

ytykhun pushed a commit to branch DATALAB-2390
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 6533946f62937c4d81f264c188f2bb82673b4b60
Author: Yurii Tykhun <[email protected]>
AuthorDate: Thu May 6 18:22:48 2021 +0300

    [DATALAB-2390] fixed bug with switching between AM and PM on sсheduler
---
 .../webapp/src/app/resources/scheduler/scheduler.calculations.ts  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.calculations.ts
 
b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.calculations.ts
index fe8a1ae..477f6e7 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.calculations.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.calculations.ts
@@ -41,11 +41,15 @@ export class SchedulerCalculations {
     return result;
   }
 
-  public static setTimeInMiliseconds(time) {
+  public static setTimeInMiliseconds(timeObj) {
+    let time = {...timeObj};
+    
     const minutes = (Number(time.minute) < 10) ? ('0' + time.minute) : 
time.minute;
     const timeMilisec = new Date().setMinutes(+minutes);
 
-    if (time.meridiem === 'PM' && time.hour < 13) time.hour += 12;
+    if (time.meridiem === 'PM' && time.hour < 12) time.hour += 12;
+    if (time.meridiem === 'AM' && time.hour === 12) time.hour -= 12;
+    
     return new Date(timeMilisec).setHours(time.hour);
   }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to