MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / getDefaultDate

Function getDefaultDate

apps/OpenSign/src/constant/Utils.js:4900–4912  ·  view source on GitHub ↗
(dateStr, format)

Source from the content-addressed store, hash-verified

4898};
4899//function to convert formatted date to new Date() format
4900export const getDefaultDate = (dateStr, format) => {
4901 //get valid date format for moment to convert formatted date to new Date() format
4902 const formats = changeDateToMomentFormat(format);
4903 const parsedDate = moment(dateStr, formats);
4904 let date;
4905 if (parsedDate.isValid()) {
4906 date = new Date(parsedDate.toISOString());
4907 return date;
4908 } else if (dateStr === "today") {
4909 date = new Date();
4910 return date;
4911 }
4912};
4913//function to get default format
4914export const getDefaultFormat = (dateFormat) => dateFormat || "MM/dd/yyyy";
4915

Callers 3

DatePickerFunction · 0.90
PlaceholderFunction · 0.90
WidgetsValueModalFunction · 0.90

Calls 1

changeDateToMomentFormatFunction · 0.85

Tested by

no test coverage detected