Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7c1163b

Browse files
committed
fix start/end available time api format
1 parent e08412e commit 7c1163b

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

src/routes/PositionDetails/components/InterviewPopup/Confirm/index.jsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ const Confirm = ({
3434
const params = {
3535
timezone: scheduleDetails.timezone,
3636
duration: scheduleDetails.duration,
37-
availableTime: scheduleDetails.slots.map((slot) => ({
38-
...slot,
39-
end: `${slot.end}:00`,
40-
start: `${slot.start}:00`,
41-
})),
37+
availableTime: scheduleDetails.slots,
4238
};
4339
onShowingLoader(true);
4440

src/routes/PositionDetails/components/InterviewPopup/ManageAvailability/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import IconDelete from "../../../../../assets/images/icon-delete-slot.svg";
1717
import IconPlus from "../../../../../assets/images/icon-plus.svg";
1818
import "./styles.module.scss";
1919
import Button from "components/Button";
20+
import { formatAs2Digits } from "utils/format";
2021

2122
/**
2223
* This component lets user to choose the availability of the interview candidate
@@ -47,7 +48,7 @@ const ManageAvailability = ({ scheduleDetails, onContinue }) => {
4748
currentVal < 12
4849
? `${!currentVal ? 12 : currentVal}:00`
4950
: `${Math.abs((currentVal === 12 ? 0 : currentVal) - 12)}:00`,
50-
time24HourFormat: currentVal + 1,
51+
time24HourFormat: `${formatAs2Digits(currentVal + 1)}:00`,
5152
suffix: currentVal < 12 ? "AM" : "PM",
5253
},
5354
],

src/routes/PositionDetails/components/InterviewPopup/index.jsx

+1-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,7 @@ const InterviewPopup = ({
5959

6060
const prepareSlots = (userSettings) => ({
6161
timezone: userSettings.defaultTimezone,
62-
slots:
63-
(userSettings.defaultAvailableTime &&
64-
userSettings.defaultAvailableTime.map((item) => ({
65-
days: item.days,
66-
end: parseInt(item.end.split(":")[0]),
67-
start: parseInt(item.start.split(":")[0]),
68-
}))) ||
69-
[],
62+
slots: userSettings.defaultAvailableTime || []
7063
});
7164

7265
/**

src/services/interviews.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { axiosInstance as axios } from "./requestInterceptor";
22
import config from "../../config";
33

44
export const getUserSettings = (userId) => {
5-
return axios.get(
6-
`${config.API.V5}/taas/user-meeting-settings/${userId}`
7-
);
5+
return axios.get(`${config.API.V5}/taas/user-meeting-settings/${userId}`);
86
};
97

108
export const deleteCalendar = (userId, calendarId) => {

src/utils/format.js

+18
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,21 @@ export const formatWorkTime = (time) => {
360360
export const formatInviteTime = (time) => {
361361
return moment(time).format("MMM D, YY");
362362
};
363+
364+
/**
365+
* Format number as 2 digits:
366+
* 7 -> 07
367+
* 07 -> 07
368+
*
369+
* @param {number|string} value 1 or 2 digits number to format
370+
* @returns {string} formatted 2-digits number
371+
*/
372+
export const formatAs2Digits = (number) => {
373+
const str = number.toString();
374+
375+
if (str.length < 2) {
376+
return "0" + str;
377+
}
378+
379+
return str;
380+
};

0 commit comments

Comments
 (0)