{"display":"form","type":"form","components":[{"id":"ecwqkgh","key":"simplecontent","html":"","type":"simplecontent","input":false,"label":"Text/Images","addons":[],"hidden":false,"prefix":"","suffix":"","unique":false,"widget":null,"dbIndex":false,"overlay":{"top":"","left":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","validate":{"custom":"","unique":false,"multiple":false,"required":false,"customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"attributes":{},"errorLabel":"","persistent":true,"properties":{},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","description":"","placeholder":"","defaultValue":null,"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","calculateServer":false,"customConditional":"","allowMultipleMasks":false,"customDefaultValue":"","allowCalculateOverride":false},{"id":"exmun7","key":"diffBetweenDates","html":"

Calculating the Difference between two dates

","type":"simplecontent","input":false,"label":"Text/Images","addons":[],"hidden":false,"prefix":"","suffix":"","unique":false,"widget":null,"dbIndex":false,"overlay":{"top":"","left":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","validate":{"custom":"","unique":false,"multiple":false,"required":false,"customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"attributes":{},"errorLabel":"","persistent":true,"properties":{},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","description":"","placeholder":"","defaultValue":null,"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","calculateServer":false,"customConditional":"","allowMultipleMasks":false,"customDefaultValue":"","allowCalculateOverride":false},{"id":"el0lh0s","key":"startDateTime","tags":[],"type":"datetime","input":true,"label":"Start Date / Time","logic":[],"addons":[],"errors":"","format":"yyyy-MM-dd hh:mm a","hidden":false,"prefix":"","suffix":"","unique":false,"widget":{"mode":"single","type":"calendar","format":"yyyy-MM-dd hh:mm a","locale":"en","maxDate":null,"minDate":null,"time_24hr":false,"allowInput":true,"enableTime":true,"noCalendar":false,"disabledDates":"","hourIncrement":1,"disableFunction":"","disableWeekdays":false,"disableWeekends":false,"minuteIncrement":1,"displayInTimezone":"viewer","useLocaleSettings":false},"dbIndex":false,"overlay":{"top":"","left":"","page":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","timezone":"","validate":{"json":"","custom":"","unique":false,"multiple":false,"required":false,"customMessage":"","customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"allowInput":true,"attributes":{},"datePicker":{"disable":"","maxDate":null,"maxMode":"year","minDate":null,"minMode":"day","initDate":"","yearRows":4,"showWeeks":true,"startingDay":0,"yearColumns":5,"disableFunction":"","disableWeekdays":false,"disableWeekends":false},"enableDate":true,"enableTime":true,"errorLabel":"","labelWidth":"","persistent":true,"properties":{},"timePicker":{"hourStep":1,"arrowkeys":true,"minuteStep":1,"mousewheel":true,"showMeridian":true,"readonlyInput":false},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","defaultDate":"","description":"","labelMargin":"","placeholder":"","defaultValue":"","customOptions":{},"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","datepickerMode":"day","calculateServer":false,"shortcutButtons":[],"customConditional":"","displayInTimezone":"viewer","useLocaleSettings":false,"allowMultipleMasks":false,"customDefaultValue":"","enableMaxDateInput":false,"enableMinDateInput":false,"allowCalculateOverride":false},{"id":"e6pcnpj","key":"endDateTime","tags":[],"type":"datetime","input":true,"label":"End Date / Time","logic":[],"addons":[],"errors":"","format":"yyyy-MM-dd hh:mm a","hidden":false,"prefix":"","suffix":"","unique":false,"widget":{"mode":"single","type":"calendar","format":"yyyy-MM-dd hh:mm a","locale":"en","maxDate":null,"minDate":null,"time_24hr":false,"allowInput":true,"enableTime":true,"noCalendar":false,"disabledDates":"","hourIncrement":1,"disableFunction":"","disableWeekdays":false,"disableWeekends":false,"minuteIncrement":1,"displayInTimezone":"viewer","useLocaleSettings":false},"dbIndex":false,"overlay":{"top":"","left":"","page":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","timezone":"","validate":{"json":"","custom":"","unique":false,"multiple":false,"required":false,"customMessage":"","customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"allowInput":true,"attributes":{},"datePicker":{"disable":"","maxDate":null,"maxMode":"year","minDate":null,"minMode":"day","initDate":"","yearRows":4,"showWeeks":true,"startingDay":0,"yearColumns":5,"disableFunction":"","disableWeekdays":false,"disableWeekends":false},"enableDate":true,"enableTime":true,"errorLabel":"","labelWidth":"","persistent":true,"properties":{},"timePicker":{"hourStep":1,"arrowkeys":true,"minuteStep":1,"mousewheel":true,"showMeridian":true,"readonlyInput":false},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","defaultDate":"","description":"","labelMargin":"","placeholder":"","defaultValue":"","customOptions":{},"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","datepickerMode":"day","calculateServer":false,"shortcutButtons":[],"customConditional":"","displayInTimezone":"viewer","useLocaleSettings":false,"allowMultipleMasks":false,"customDefaultValue":"","enableMaxDateInput":false,"enableMinDateInput":false,"allowCalculateOverride":false},{"id":"e28ip8h","key":"numberOfDays3","mask":false,"tags":[],"type":"number","input":true,"label":"Number of Days","logic":[],"addons":[],"errors":"","hidden":false,"prefix":"","suffix":"","unique":false,"widget":{"type":"input"},"dbIndex":false,"overlay":{"top":"","left":"","page":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","validate":{"max":"","min":"","json":"","step":"any","custom":"","unique":false,"integer":"","multiple":false,"required":false,"customMessage":"","customPrivate":false,"strictDateValidation":false},"autofocus":false,"delimiter":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"attributes":{},"errorLabel":"","labelWidth":"","persistent":true,"properties":{},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","description":"","displayMask":"","inputFormat":"plain","labelMargin":"","placeholder":"","autocomplete":"","decimalLimit":"","defaultValue":"","dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"const date1String = data.startDateTime; // date string 1, change \"startDateTime\" to the name of your first date field\nconst date2String = data.endDateTime; // date string 2, change \"endDateTime\" to the name of your second date field\n\nconst date1 = new Date(date1String); //changes the data types from strings to dates\nconst date2 = new Date(date2String); \n\n// Calculate the difference between the two dates in milliseconds and converts the date to a number\nconst diffInMs = date2 - date1;\n\n// Convert the difference in milliseconds to days\nconst diffInDays = Math.floor(diffInMs / (1000 * 60 * 60 * 24));\n\nvalue = diffInDays; // assigns the calculated number of days to the value that will be displayed in the field\n","requireDecimal":false,"calculateServer":false,"customConditional":"","allowMultipleMasks":false,"customDefaultValue":"","allowCalculateOverride":false,"truncateMultipleSpaces":false},{"id":"ezfxzoh","key":"yearLater","html":"

 

1 Year after the End Date

","type":"simplecontent","input":false,"label":"Text/Images","addons":[],"hidden":false,"prefix":"","suffix":"","unique":false,"widget":null,"dbIndex":false,"overlay":{"top":"","left":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","validate":{"custom":"","unique":false,"multiple":false,"required":false,"customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"attributes":{},"errorLabel":"","persistent":true,"properties":{},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","description":"","placeholder":"","defaultValue":null,"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","calculateServer":false,"customConditional":"","allowMultipleMasks":false,"customDefaultValue":"","allowCalculateOverride":false},{"id":"epzh6eh","key":"dateTimeYrLater","tags":[],"type":"datetime","input":true,"label":"Date / Time","logic":[],"addons":[],"errors":"","format":"yyyy-MM-dd","hidden":false,"prefix":"","suffix":"","unique":false,"widget":{"mode":"single","type":"calendar","format":"yyyy-MM-dd","locale":"en","maxDate":null,"minDate":null,"time_24hr":false,"allowInput":true,"enableTime":true,"noCalendar":false,"disabledDates":"","hourIncrement":1,"disableFunction":"","disableWeekdays":false,"disableWeekends":false,"minuteIncrement":1,"displayInTimezone":"viewer","useLocaleSettings":false},"dbIndex":false,"overlay":{"top":"","left":"","page":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"multiple":false,"redrawOn":"","tabindex":"","timezone":"","validate":{"json":"","custom":"","unique":false,"multiple":false,"required":false,"customMessage":"","customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","tableView":false,"allowInput":true,"attributes":{},"datePicker":{"disable":"","maxDate":null,"maxMode":"year","minDate":null,"minMode":"day","initDate":"","yearRows":4,"showWeeks":true,"startingDay":0,"yearColumns":5,"disableFunction":"","disableWeekdays":false,"disableWeekends":false},"enableDate":true,"enableTime":true,"errorLabel":"","labelWidth":"","persistent":true,"properties":{},"timePicker":{"hourStep":1,"arrowkeys":true,"minuteStep":1,"mousewheel":true,"showMeridian":true,"readonlyInput":false},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","json":"","show":null,"when":null},"customClass":"","defaultDate":"","description":"","labelMargin":"","placeholder":"","defaultValue":"","customOptions":{},"dataGridLabel":false,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"// get the value of the original Date/Time field\nvar originalDateTime = new Date(data.endDateTime);\n\n// add one year to the original Date/Time value\nvar oneYearLater = new Date(originalDateTime.setFullYear(originalDateTime.getFullYear() + 1));\n\n// format the new Date/Time value as a string in the format 'YYYY-MM-DDTHH:mm'\nvar formattedDateTime = oneYearLater.toISOString().slice(0, 16);\n\n// set the value of the new Date/Time field to the formatted string\nvalue = formattedDateTime;\n","datepickerMode":"day","calculateServer":false,"shortcutButtons":[],"customConditional":"","displayInTimezone":"viewer","useLocaleSettings":false,"allowMultipleMasks":false,"customDefaultValue":"","enableMaxDateInput":false,"enableMinDateInput":false,"allowCalculateOverride":false},{"id":"esijp5","key":"submit","size":"md","type":"button","block":false,"input":true,"label":"Submit","theme":"primary","action":"submit","addons":[],"hidden":false,"prefix":"","suffix":"","unique":false,"widget":{"type":"input"},"dbIndex":false,"overlay":{"top":"","left":"","style":"","width":"","height":""},"tooltip":"","disabled":false,"leftIcon":"","multiple":false,"redrawOn":"","tabindex":"","validate":{"custom":"","unique":false,"multiple":false,"required":false,"customPrivate":false,"strictDateValidation":false},"autofocus":false,"encrypted":false,"hideLabel":false,"modalEdit":false,"protected":false,"refreshOn":"","rightIcon":"","tableView":false,"attributes":{},"errorLabel":"","persistent":false,"properties":{},"validateOn":"change","clearOnHide":true,"conditional":{"eq":"","show":null,"when":null},"customClass":"","description":"","placeholder":"","defaultValue":null,"dataGridLabel":true,"labelPosition":"top","showCharCount":false,"showWordCount":false,"calculateValue":"","calculateServer":false,"disableOnInvalid":true,"allowMultipleMasks":false,"customDefaultValue":"","allowCalculateOverride":false}]}