1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/utils/formatConstraintValue.ts
olav eb5e83cdb4 refactor: remove unused code (#1036)
* refactor: remove unused code

* refactor: remove more unused code
2022-05-27 13:28:58 +02:00

19 lines
597 B
TypeScript

import { IConstraint } from 'interfaces/strategy';
import { formatDateYMDHMS } from 'utils/formatDate';
import { ILocationSettings } from 'hooks/useLocationSettings';
import { CURRENT_TIME_CONTEXT_FIELD } from 'utils/operatorsForContext';
export const formatConstraintValue = (
constraint: IConstraint,
locationSettings: ILocationSettings
): string | undefined => {
if (
constraint.value &&
constraint.contextName === CURRENT_TIME_CONTEXT_FIELD
) {
return formatDateYMDHMS(constraint.value, locationSettings.locale);
}
return constraint.value;
};