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

Function formatCSVDate

apps/OpenSign/src/utils/widgetUtils.js:461–474  ·  view source on GitHub ↗
(widget, response, formatInISO = false)

Source from the content-addressed store, hash-verified

459 }
460};
461export const formatCSVDate = (widget, response, formatInISO = false) => {
462 const format = widget?.options?.validation?.format ?? "dd-MM-yyyy";
463 const input = response === "today" ? new Date() : response;
464 // moment strict parse; fallback to "today" if invalid
465 const m = moment(input, changeDateToMomentFormat(format), true);
466 const date = m.isValid()
467 ? m
468 : moment(new Date(), changeDateToMomentFormat(format), true);
469
470 const finalResponse = formatInISO
471 ? date.format("DD-MM-YYYY")
472 : date.format(format?.toUpperCase());
473 return finalResponse;
474};
475
476export const loadPdfOnce = async (url) => {
477 try {

Callers 1

Calls 1

changeDateToMomentFormatFunction · 0.90

Tested by

no test coverage detected