Date Pickers using current and year ahead

I have a date picker below for the start date, works fine

@Html.LocalisedDateTimeFor(model => model.StartDate, new Dictionary<string, string>() { { "id", "txtStartDate" }, { "data-default-date", "today" } });

But I need another one that’s end date that defaults to today’s date but a year ahead, can I do this within the line of code similar to above

Think I got it, will post for others

@Html.LocalisedDateTimeFor(model => model.EndDate, new Dictionary<string, string>() { { "id", "txtEndDate" }, { "data-default-date", DateTime.Now.AddYears(1).ToString("yyyy-MM-dd") } });

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.