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 69a49062f48cb27e9da97857092b420f959d2e12
Author: Yurii Tykhun <[email protected]>
AuthorDate: Fri May 7 10:31:07 2021 +0300

    [DATALAB-2390] fixed bug with switching between AM and PM on sсheduler in 
dev env
---
 .../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..1ceb5f8 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