Excel file with Date Field from Dataverse this is stored as for Example as
19/01/2024 17:00:00
Unclear if relevant but Custom column Type formatting as
yyyy-mm-ddThh:mm:ssZ
This is then converted in the form as example:
In real form this is part of a datagrid
var excelTime = instance.root.getComponent("milestones").selectOptions[0].value["Finish"];
var intermediateTime = excelTime - 25569;
var finalTime = intermediateTime * 86400;
var output = moment.unix(finalTime);
value = output;
Source Code below{
"title": "Date Fail",
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" color=\"#9065b0\" stroke=\"#9065b0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"transparent\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path><path d=\"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2\"></path><path d=\"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z\"></path><path d=\"M9 14h.01\"></path><path d=\"M9 17h.01\"></path><path d=\"M12 16l1 1l3 -3\"></path>\n</svg>",
"schema": {
"display": "form",
"components": [
{
"label": "Date / Time",
"labelPosition": "top",
"displayInTimezone": "viewer",
"useLocaleSettings": false,
"allowInput": true,
"format": "yyyy-MM-dd hh:mm a",
"placeholder": "",
"description": "",
"tooltip": "",
"customClass": "",
"customClassAdvanced": "",
"tabindex": "",
"hidden": false,
"hiddenInPdf": false,
"hideLabel": false,
"autofocus": false,
"disabled": false,
"tableView": false,
"modalEdit": false,
"shortcutButtons": [],
"enableDate": true,
"datePicker": {
"disable": "",
"disableFunction": "",
"disableWeekends": false,
"disableWeekdays": false,
"minDate": null,
"maxDate": null,
"showWeeks": true,
"startingDay": 0,
"initDate": "",
"minMode": "day",
"maxMode": "year",
"yearRows": 4,
"yearColumns": 5
},
"enableTime": true,
"timePicker": {
"showMeridian": true,
"hourStep": 1,
"minuteStep": 1,
"readonlyInput": false,
"mousewheel": true,
"arrowkeys": true
},
"multiple": false,
"defaultValue": "",
"defaultDate": "",
"customOptions": {},
"redrawOn": "",
"clearOnHide": false,
"customDefaultValue": "",
"calculateValue": "var excelTime = instance.root.getComponent(\"milestones\").selectOptions[0].value[\"Finish\"];\r\nvar intermediateTime = excelTime - 25569;\r\nvar finalTime = intermediateTime * 86400;\r\nvar output = moment.unix(finalTime);\r\nvalue = output;",
"allowCalculateOverride": false,
"validateOn": "change",
"validate": {
"required": false,
"customMessage": "",
"custom": "",
"customPrivate": false,
"strictDateValidation": false,
"multiple": false,
"unique": false
},
"enableMinDateInput": false,
"enableMaxDateInput": false,
"errorLabel": "",
"errors": "",
"key": "dateTime",
"tags": [],
"properties": {},
"conditional": {
"show": null,
"when": null,
"eq": ""
},
"customConditional": "",
"logic": [],
"onChange": "",
"attributes": {},
"creatorPermissions": "",
"permissions": [
{
"user": {},
"permissionLevel": ""
}
],
"type": "datetime",
"timezone": "",
"input": true,
"widget": {
"type": "calendar",
"displayInTimezone": "viewer",
"locale": "en",
"useLocaleSettings": false,
"allowInput": true,
"mode": "single",
"enableTime": true,
"noCalendar": false,
"format": "yyyy-MM-dd hh:mm a",
"hourIncrement": 1,
"minuteIncrement": 1,
"time_24hr": false,
"minDate": null,
"disabledDates": "",
"disableWeekends": false,
"disableWeekdays": false,
"disableFunction": "",
"maxDate": null
},
"skipRemoveConfirm": true,
"prefix": "",
"suffix": "",
"protected": false,
"unique": false,
"persistent": true,
"refreshOn": "",
"dataGridLabel": false,
"dbIndex": false,
"calculateServer": false,
"overlay": {
"style": "",
"left": "",
"top": "",
"width": "",
"height": ""
},
"encrypted": false,
"showCharCount": false,
"showWordCount": false,
"allowMultipleMasks": false,
"addons": [],
"datepickerMode": "day"
},
{
"label": "Milestones",
"labelPosition": "top",
"widget": "html5",
"placeholder": "",
"description": "",
"tooltip": "",
"customClass": "",
"customClassAdvanced": "",
"tabindex": "",
"hidden": false,
"hiddenInPdf": false,
"hideLabel": false,
"autofocus": false,
"disabled": false,
"tableView": true,
"modalEdit": false,
"multiple": false,
"dataSourceId": "j6t9tjq62emy",
"labelProperty": {
"label": "Project Task Name",
"value": "Project Task Name"
},
"template": "<span>{{ item['Project Task Name'] }}</span>",
"filterQuery": "",
"refreshOn": "",
"clearOnRefresh": false,
"clearOnHide": true,
"customOptions": {},
"calculateValue": "",
"sortBy": "",
"sortDirection": "",
"removeDuplicates": true,
"selectFields": "",
"sampleItem": {
"Project Task Name": "Enter Project Name Here",
"Owner (Lookup)": "Daniel Kendall",
"Project (Lookup)": "Project Template Light Example",
"Project Bucket (Lookup)": "Not Started",
"Project Task Status": "Active",
"% Complete": 0.06,
"Critical": true,
"Display Sequence": 2,
"Due Date": 45310.7083333333,
"Duration": 35,
"Effort": 70,
"Effort Completed (Hours)": 8,
"Effort Remaining (Hours)": 62,
"Finish": 45310.7083333333,
"Is Milestone": false,
"Manually Scheduled": false,
"Notes": "",
"Notes - Plain text": "",
"Outline Level": 1,
"Parent Task (Lookup)": "",
"Priority": 5,
"Project for the web CreatedBy (Lookup)": "Daniel Kendall",
"Project for the web ModifiedBy (Lookup)": "Nicol Cutts",
"Project Sprint (Lookup)": "",
"Resourcing unit (Deprecated in v3.0) (Lookup)": "",
"Role (Deprecated in v3.0) (Lookup)": "",
"Start": 45264.375,
"Start Date": 45264.375,
"Summary Task": true,
"Created By (Lookup)": "Microsoft Project",
"Created By (Delegate) (Lookup)": "",
"Created On": 45240.5483564815,
"Import Sequence Number": "",
"Modified By (Lookup)": "Microsoft Project",
"Modified By (Delegate) (Lookup)": "",
"Modified On": 45244.3578819444,
"Owning Business Unit (Lookup)": "stoneseedsandbox",
"Owning Team (Lookup)": "",
"Record Created On": "",
"Status Reason": "Active",
"Time Zone Rule Version Number": 4,
"Traversed Path": "",
"UTC Conversion Time Zone Code": "",
"Version Number": 2411011,
"Project task ID": "8c823e62-ca7f-ee11-8171-000d3a467ca0",
"Process Id": "",
"Created By": "643dcc5e-5f7d-ee11-8179-000d3aa9254e",
"Created By (Delegate)": "",
"Modified By": "643dcc5e-5f7d-ee11-8179-000d3aa9254e",
"Modified By (Delegate)": "",
"Owner": "6e61cbe6-627d-ee11-8179-000d3aa9254e",
"Owning Business Unit": "ef49924b-967a-ee11-8179-000d3abf51a9",
"Owning Team": "",
"Parent Task": "",
"Project": "74cff85d-ca7f-ee11-8179-0022488ab225",
"Project Bucket": "96823e62-ca7f-ee11-8171-000d3a467ca0",
"Project for the web CreatedBy": "6e61cbe6-627d-ee11-8179-000d3aa9254e",
"Project for the web ModifiedBy": "cb82193b-647d-ee11-8179-0022488ab225",
"Project Sprint": "",
"Resourcing unit (Deprecated in v3.0)": "",
"Role (Deprecated in v3.0)": "",
"Owning User": "",
"Owning User2": "6e61cbe6-627d-ee11-8179-000d3aa9254e",
"_stageid_value": "",
"_stageid_value3": "",
"Finish Text": ""
},
"validateOn": "change",
"validate": {
"required": false,
"customMessage": "",
"custom": "",
"customPrivate": false,
"strictDateValidation": false,
"multiple": false,
"unique": false,
"onlyAvailableItems": false
},
"errorLabel": "",
"errors": "",
"key": "milestones",
"tags": [],
"properties": {},
"conditional": {
"show": null,
"when": null,
"eq": ""
},
"customConditional": "",
"logic": [],
"onChange": "",
"attributes": {},
"creatorPermissions": "",
"permissions": [
{
"user": {},
"permissionLevel": ""
}
],
"type": "spSelect",
"input": true,
"prefix": "",
"suffix": "",
"protected": false,
"unique": false,
"persistent": true,
"redrawOn": "",
"dataGridLabel": false,
"dbIndex": false,
"customDefaultValue": "",
"calculateServer": false,
"overlay": {
"style": "",
"left": "",
"top": "",
"width": "",
"height": ""
},
"allowCalculateOverride": false,
"encrypted": false,
"showCharCount": false,
"showWordCount": false,
"allowMultipleMasks": false,
"addons": [],
"dataSrc": "custom",
"authenticate": false,
"ignoreCache": false,
"idPath": "id",
"data": {
"values": [
{
"label": "",
"value": ""
}
],
"json": "",
"url": "",
"resource": "",
"custom": "values = instance.customQuery(component)"
},
"limit": 100,
"valueProperty": "",
"lazyLoad": true,
"filter": "",
"searchEnabled": true,
"searchDebounce": 0.3,
"searchField": "",
"minSearch": 0,
"readOnlyValue": false,
"selectThreshold": 0.3,
"uniqueOptions": false,
"fuseOptions": {
"include": "score",
"threshold": 0.3
},
"indexeddb": {
"filter": {}
},
"useExactSearch": false,
"tag": "h1",
"skipRemoveConfirm": true,
"defaultValue": {}
},
{
"type": "button",
"label": "Submit",
"key": "submit",
"size": "md",
"block": false,
"action": "submit",
"disableOnInvalid": false,
"theme": "primary",
"input": true,
"placeholder": "",
"prefix": "",
"customClass": "",
"suffix": "",
"multiple": false,
"defaultValue": null,
"protected": false,
"unique": false,
"persistent": false,
"hidden": false,
"clearOnHide": true,
"refreshOn": "",
"redrawOn": "",
"tableView": false,
"modalEdit": false,
"dataGridLabel": true,
"labelPosition": "top",
"description": "",
"errorLabel": "",
"tooltip": "",
"hideLabel": false,
"tabindex": "",
"disabled": false,
"autofocus": false,
"dbIndex": false,
"customDefaultValue": "",
"calculateValue": "",
"calculateServer": false,
"widget": {
"type": "input"
},
"attributes": {},
"validateOn": "change",
"validate": {
"required": false,
"custom": "",
"customPrivate": false,
"strictDateValidation": false,
"multiple": false,
"unique": false
},
"conditional": {
"show": null,
"when": null,
"eq": ""
},
"overlay": {
"style": "",
"left": "",
"top": "",
"width": "",
"height": ""
},
"allowCalculateOverride": false,
"encrypted": false,
"showCharCount": false,
"showWordCount": false,
"properties": {},
"allowMultipleMasks": false,
"addons": [],
"leftIcon": "",
"rightIcon": "",
"skipRemoveConfirm": true
}
]
}
}
Actually this is not the issue see:
Custom Value no longer works on Date Fields (teamforms.app)
Actually this is not the issue see:
Custom Value no longer works on Date Fields (teamforms.app)
Since this one is solved by Custom Value no longer works on Date Fields (teamforms.app)
I'll go ahead and mark this as solved :)