Skip to content

Commit

Permalink
Fix: fixing time range conditions M2-8301 (#908)
Browse files Browse the repository at this point in the history
* fix/M2-8277_fixing_EqualToValue

* fixing is greater than time range condition

* fix: fixing time range condition

* fixing unit test

---------

Co-authored-by: Felipe Imperio <felipeimp@Felipes-MacBook-Pro.local>
  • Loading branch information
felipeMetaLab and Felipe Imperio authored Dec 2, 2024
1 parent 9afa887 commit 4c7f92f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/entities/conditional-logic/model/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ export const isGreaterThanTimeRange = (
}>,
{ time, fieldName }: { time: HourMinute; fieldName: string },
): boolean => {
if (!isValidTimeFormat(time) || !timeRange) return false;
if (!time || !timeRange) return false;

const selectedTime = getTimeBasedOnFieldName(fieldName, timeRange);

if (!isValidTimeFormat(selectedTime)) return false;

const normalizedTime =
typeof time === 'string' ? parseTimeString(time) : time;

Expand All @@ -162,9 +166,12 @@ export const isLessThanTimeRange = (
}>,
{ time, fieldName }: { time: HourMinute; fieldName: string },
): boolean => {
if (!isValidTimeFormat(time) || !timeRange) return false;
if (!time || !timeRange) return false;

const selectedTime = getTimeBasedOnFieldName(fieldName, timeRange);

if (!isValidTimeFormat(selectedTime)) return false;

const normalizedTime =
typeof time === 'string' ? parseTimeString(time) : time;

Expand All @@ -180,9 +187,12 @@ export const isEqualToTimeRange = (
}>,
{ time, fieldName }: { time: HourMinute; fieldName: string },
): boolean => {
if (!isValidTimeFormat(time) || !timeRange) return false;
if (!time || !timeRange) return false;

const selectedTime = getTimeBasedOnFieldName(fieldName, timeRange);

if (!isValidTimeFormat(selectedTime)) return false;

const normalizedTime =
typeof time === 'string' ? parseTimeString(time) : time;

Expand All @@ -198,8 +208,12 @@ export const isNotEqualToTimeRange = (
}>,
{ time, fieldName }: { time: HourMinute; fieldName: string },
): boolean => {
if (!isValidTimeFormat(time) || !timeRange) return false;
if (!time || !timeRange) return false;

const selectedTime = getTimeBasedOnFieldName(fieldName, timeRange);

if (!isValidTimeFormat(selectedTime)) return false;

const normalizedTime =
typeof time === 'string' ? parseTimeString(time) : time;

Expand Down

0 comments on commit 4c7f92f

Please sign in to comment.