Skip to content

Commit

Permalink
hotfix: fix trimming date (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 authored Oct 24, 2024
1 parent 5558552 commit a129db5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/prefer-default-export */

import { baseApiUrl, parseData } from '@openimis/fe-core';
import { MPAY_BILL_URL, WORKER_VOUCHER_STATUS } from '../constants';
import { EMPTY_STRING, MPAY_BILL_URL, WORKER_VOUCHER_STATUS } from '../constants';
import { fetchMutation } from '../actions';

const fetchMPayArgs = async (url) => {
Expand Down Expand Up @@ -74,4 +74,8 @@ export const getLastMutationLog = async (dispatch, mutationId) => {
export const isTheVoucherExpired = (voucher) => voucher.status === WORKER_VOUCHER_STATUS.EXPIRED
|| new Date(voucher.expiryDate) < new Date();

export const trimDate = (date) => date.split('T')[0];
export const trimDate = (date) => {
if (!date) return EMPTY_STRING;

return date.split('T')?.[0] ?? date;
};

0 comments on commit a129db5

Please sign in to comment.