I have Date in SharePoint server 2013 and I want to add 14 days on it by jQuery
I have the column name EndDate
text type.
I have Date in SharePoint server 2013 and I want to add 14 days on it by jQuery
I have the column name EndDate
text type.
You can do this by attaching a JSLink file to the edit/new form webpart.
On that file use something like
(function () {
var ctx = {};
ctx.Templates = {};
ctx.Templates.Fields = {
'EndDate': { 'NewForm': renderEndDateField }
}
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx);
})();
// This function provides the rendering logic
function renderEndDateField() {
var today = new Date();
var endDate = new Date();
endDate.setDate(today.getDate()+14);
var day = endDate.getDate();
var month = endDate.getMonth();
var year = endDate.getFullYear();
ctx.CurrentFieldValue = day + '-' + month+1 + '-' + year ;
return SPFieldText_Edit(ctx);
}