make formatdates function shared in utils

This commit is contained in:
2023-10-24 07:35:43 +01:00
parent 0c98bcd831
commit 798ba01ea6
6 changed files with 481 additions and 110 deletions
+1 -9
View File
@@ -10,6 +10,7 @@ import transLookup from "../../data/lookuptranslations.json";
import { getRepresentations } from "../../actions";
import { setRepresentations } from "../../store/searchOutput/action";
import PaginationControl from "./pagination";
import { formatDates } from "../utils";
const RepresentationList = (props) => {
const { incidentid, representationsObj, setRepresentations } = props;
@@ -153,15 +154,6 @@ const RepresentationList = (props) => {
const representationResultsObj = representationDetailsObj();
}, [incidentid, setRepresentations]);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
return dd + "/" + mm + "/" + yyyy;
}
const pagesCount = Math.ceil(representationsObj["@odata.count"] / 10);
let currentPage = 0;