@paro.io/expert-shared-components 1.10.3 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,10 +77,16 @@ const TASK_HOURS_VALIDATION = {
|
|
|
77
77
|
NON_EMPTY_ERROR_MSG: "Hours can't be empty",
|
|
78
78
|
GREATER_THAN_ZERO: "Hours or minutes should be greater than zero"
|
|
79
79
|
};
|
|
80
|
-
const addHoursAndMinutes = (hours, minutes) => {
|
|
80
|
+
const addHoursAndMinutes = (hours, minutes, disableHoursRounding) => {
|
|
81
81
|
const MINUTES_IN_AN_HOUR = 60;
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const minutesToHoursNormal = minutes / MINUTES_IN_AN_HOUR;
|
|
83
|
+
if (disableHoursRounding) {
|
|
84
|
+
return Number((hours + minutesToHoursNormal).toFixed(2));
|
|
85
|
+
}
|
|
86
|
+
const roundedTime = (0, exports.roundMinutes)(minutes, 0);
|
|
87
|
+
const totalHours = hours + roundedTime.hours;
|
|
88
|
+
const minutesToHours = roundedTime.minutes / MINUTES_IN_AN_HOUR;
|
|
89
|
+
return Number((totalHours + minutesToHours).toFixed(2));
|
|
84
90
|
};
|
|
85
91
|
const getMaxDateForAddTimeLog = () => {
|
|
86
92
|
const date = new Date();
|
|
@@ -176,7 +182,7 @@ const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setSh
|
|
|
176
182
|
return false;
|
|
177
183
|
};
|
|
178
184
|
(0, react_1.useEffect)(() => {
|
|
179
|
-
const hoursAndMinutes = addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2);
|
|
185
|
+
const hoursAndMinutes = addHoursAndMinutes(Number(hours), Number(minutes) || 0, disableHours).toFixed(2);
|
|
180
186
|
if (Number(hoursAndMinutes) > 24) {
|
|
181
187
|
setIsHoursExceeded(true);
|
|
182
188
|
}
|
|
@@ -257,7 +263,7 @@ const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setSh
|
|
|
257
263
|
const taskDescriptionInvalid = validateTaskDescription(taskDescription);
|
|
258
264
|
if (isHoursInValid && minutesInvalid && taskDescriptionInvalid) {
|
|
259
265
|
const roundedTime = (0, exports.roundMinutes)(Number(minutes), Number(hours));
|
|
260
|
-
const totalHours = disableHours ? parseFloat(addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2)) : parseFloat((roundedTime.hours + roundedTime.minutes / 60).toFixed(2));
|
|
266
|
+
const totalHours = disableHours ? parseFloat(addHoursAndMinutes(Number(hours), Number(minutes) || 0, disableHours).toFixed(2)) : parseFloat((roundedTime.hours + roundedTime.minutes / 60).toFixed(2));
|
|
261
267
|
let progressBarHours = 0;
|
|
262
268
|
if (isRecurringHourlyProject) {
|
|
263
269
|
progressBarHours = ((0, dayjs_1.default)(timeLogDate).isAfter(firstDateOfMonth, 'day') && (0, dayjs_1.default)(timeLogDate).isBefore(lastDateOfMonth, 'day') || (0, dayjs_1.default)(timeLogDate).isSame(firstDateOfMonth, 'day') || (0, dayjs_1.default)(timeLogDate).isSame(lastDateOfMonth, 'day')) ? totalHours : 0;
|