(widget, response, formatInISO = false)
| 459 | } |
| 460 | }; |
| 461 | export 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 | |
| 476 | export const loadPdfOnce = async (url) => { |
| 477 | try { |
no test coverage detected