Skip to content

Commit

Permalink
Update Date.js (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunarora-eGov authored Sep 1, 2023
1 parent 0ef9b90 commit ac816ae
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { format, toDate } from "date-fns";

export const ConvertTimestampToDate = (timestamp, dateFormat = "d-MMM-yyyy") => {

return timestamp ? format(toDate(timestamp), dateFormat) : null;
};

Expand Down Expand Up @@ -35,7 +36,7 @@ export const ConvertEpochToTimeInHours = (dateEpoch) => {
const dateFromApi = new Date(dateEpoch);
let hour = dateFromApi.getHours();
let min = dateFromApi.getMinutes();
let period = hour > 12 ? "PM" : "AM";
let period = hour >= 12 ? "PM" : "AM";
hour = hour > 12 ? hour - 12 : hour;
hour = (hour > 9 ? "" : "0") + hour;
min = (min > 9 ? "" : "0") + min;
Expand Down

0 comments on commit ac816ae

Please sign in to comment.