MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / changeDateFormat

Function changeDateFormat

apps/OpenSign/src/components/pdf/Placeholder.jsx:175–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173 //it support date in this type - "2025-09-11"// ISO string, "2025-09-11T14:30:00" // ISO datetime
174 //function change format array list with selected date and format
175 const changeDateFormat = () => {
176 const updateDate = [];
177 dateFormat.map((data) => {
178 let date = selectDate?.date || new Date();
179 const isString = typeof date === "string";
180 if (selectDate.format === "dd-MM-yyyy" && isString) {
181 const [day, month, year] = date.split("-");
182 date = new Date(`${year}-${month}-${day}`);
183 } else if (selectDate.format === "dd.MM.yyyy" && isString) {
184 const [day, month, year] = date.split(".");
185 date = new Date(`${year}.${month}.${day}`);
186 } else if (selectDate.format === "dd/MM/yyyy" && isString) {
187 const [day, month, year] = date.split("/");
188 date = new Date(`${year}/${month}/${day}`);
189 } else {
190 date = selectDate?.date ? new Date(selectDate?.date) : new Date();
191 }
192 const milliseconds = date.getTime();
193 const newDate = moment(milliseconds).format(data);
194 const dateObj = { date: newDate, format: selectFormat(data) };
195 updateDate.push(dateObj);
196 });
197 setDateFormatList(updateDate);
198 };
199
200 useEffect(() => {
201 if (props.isPlaceholder || isSelfSign) {

Callers 1

PlaceholderFunction · 0.85

Calls 1

selectFormatFunction · 0.90

Tested by

no test coverage detected