Home › Forums › Autocomplete › Set Date Picker with correct format
Tagged: autocomplete
- This topic has 1 reply, 2 voices, and was last updated 6 years ago by Alexander Bautz.
-
AuthorPosts
-
-
December 11, 2018 at 14:41 #23075
Hello Alexander,
I am using Autocomplete to set a date picker field of a related list item. the format after setting the field comes out as YYYY-MM-DD 0. Any help you could provide on how to format this would be very helpful. Below is the Autocomplete from the custom JS tab. Thank you very much for your help.spjs.ac.textField({
“applyTo”: “exerciseName”,
“helpText”: “Copy and Paste Exercise name here…”,
“loadText”: “”,
“listGuid”: “{5069237B-77D7-4E64-9120-DCE5AF2125DC}”,
“listBaseUrl”: “/sites/XT”,
“showField”: “Generated_x0020_Exercise_x0020_I”,
“searchFields”: [],
“filterCAML”: “<Where><Geq><FieldRef Name=’Exercise_x0020_Start_x0020_Date’/><Value Type=’DateTime’ IncludeTimeValue=’FALSE’><Today /></Value></Geq></Where>”,
“useREST”: false,
“preloadData”:false,
“filterREST”: “”,
“optionDetailFields”: [],
“optionDetailPrefix”: [],
“enforceUniqueValues”: true,
“rowLimit”: 15,
“listOptionsOnFocus”: false,
“minLengthBeforeSearch”: 3,
“reValidateOnLoad”: false,
“allowAddNew”: false,
“isLookupInSelf”: false,
“addNewAdditionalFields”: [],
“multiselect”: false,
“multiselectSeparator”: “; “,
“orderBy”: [],
“clearSetFieldsOnInvalidSelection”: false,
“setFields”: [
{
“fromFIN”:[“Exercise_x0020_Start_x0020_Date”],
“joinBy”:””,
“toFIN”:”currentStart”,
“parseFunction”:””,
“skipIfEmpty”:false
},
{
“fromFIN”:[“Exercise_x0020_End_x0020_Date”],
“joinBy”:””,
“toFIN”:”currentEnd”,
“parseFunction”:””,
“skipIfEmpty”:false
}
],
“debug”: false
}); -
December 11, 2018 at 18:48 #23083
Hi,
You must use the parseFunction like this:... ... "setFields":[ { "fromFIN":["Exercise_x0020_End_x0020_Date"], "joinBy":"", "toFIN":"currentEnd", "parseFunction":"fixDateValue", "skipIfEmpty":false } ] }); function fixDateValue(s){ var date = new Date(s[0]); // Fix the returned format to match your current date format return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear(); }
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.