Skip to content

Infragistics Community Forum / Web / Ignite UI for ASP.NET Core / Regarding Setting date in datepicker which is out of min max range.

Regarding Setting date in datepicker which is out of min max range.

New Discussion
Rohit Rawat
Rohit Rawat asked on Mar 3, 2026 1:22 PM

Hello Team,

I have two date columns: action_date and action_due_date. If a row contains a date that is outside the currently allowed range and the user attempts to edit that row, the original (out-of-range) date should still be displayed without error message.. Additionally, the user should be able to save the row as long as they have not selected a new date inside the current valid range.

I am using a different syntax to bind the igGrid. Below is a sample column configuration for your reference:

{
columnKey: “action_date”,
editorType: “datepicker”,
required: true,
editorOptions: {
dateInputFormat: “yyyy-MM-dd”,
valueFormat: “date”,
datepickerOptions: {
changeMonth: true,
changeYear: true
},
validatorOptions: {
required: true,
notificationOptions: {
mode: “popover”
},
errorMessage: resource_d3_process.ActionDateReq
}
}
}

Could you please guide me on how to apply custom validation in this case?

Also, if I apply custom validation, will it interfere with the existing required validation? Specifically, I want to ensure that the original out-of-range date is not reset automatically and that validation only applies when the user selects a new date.

Is there any way i could turn off the max min range validation? As the date selected will always be in range during adding time and if user edit after 3 date still that day would be visible and user can change the date to new if he wants wihtin current new range?

Looking forward to your response.

Thanks and regards,
Rohit Rawat

Sign In to post a reply

Replies

  • 0
    Arkan Ahmedov
    Arkan Ahmedov answered on Mar 4, 2026 1:15 PM

    Hello Rohit,

    Thank you for the detailed description. Please find the attached sample which addresses all three points you raised.

    What was implemented:

    Legacy out-of-range dates are preserved — When a user opens a row for editing, the existing date is captured and stored. If the user saves without changing it, validation is skipped entirely regardless of whether the date falls outside the current allowed range.

    Range validation only fires on new picks — The custom validator compares the editor’s current value against the stored original. Only when a genuinely new date is selected does the range check run. If the new date falls outside the live window (today ±1 month in this sample, adjustable to your business rules), a popover error message is shown and the save is blocked.

    Required validation is preserved — The required: true rule still fires independently. If the user clears the date field entirely, the required error will display as expected without conflicting with the custom range logic.

    Built-in minValue/maxValue removed — We removed the editor-level min/max constraints and replaced them entirely with the custom validator so legacy data is never rejected automatically on edit.

    To adjust the valid date window, locate the getCurrentRangeBounds() function in the sample and update the setMonth offsets to match your business rules.

    Please test the attached sample and let us know if you need any further adjustments.

    Best Regards,
    Arkan Ahmedov
    Infragistics

    Attachments:
  • 0
    Rohit Rawat
    Rohit Rawat answered on Mar 5, 2026 3:41 AM

    Hello Arkan,

    Thanks for the reply. I have checked it everything is fine but one issue. Can we  disabled the dates outside range? like if user has selected 3 march 2026 and he tries to edit it on 6 march 2026. The calendar range should be current  and current + 3 months (range can be different) rest disabled. But when he tries to edit calender should still show 3 march without out of range validation even tho its fine that he cannot selet that date again once changed by opening calender.

    If its possible do let me know. Looking forward to your response.

    Thanks and regards

    Rohit Rawat

    • 0
      Arkan Ahmedov
      Arkan Ahmedov answered on Mar 5, 2026 1:53 PM

      Hello Rohit,

      Thank you for the follow-up. We have reviewed your request and are pleased to confirm that the requirements have been implemented successfully. Please find the sample attached for your reference.

      What was done:

      1. Calendar dates outside the valid range are now disabled — When the user opens the datepicker, all dates outside the current allowed window (today through today + 3 months) are greyed out and cannot be selected. The range window is configurable via the getCurrentRangeBounds() function and can be adjusted to match your business rules.
      2. Legacy out-of-range dates remain visible without errors — If a row already contains a date outside the current window (e.g. a date that was valid at the time of entry), the editor will still display that date correctly when the user opens the cell for editing. No validation error will be shown and the user can save the row without modification.
      3. Validation on new picks is preserved — If the user opens the calendar and selects a new date, only in-range dates are selectable due to the calendar disabling. The save-side validator also remains in place as a secondary safeguard.
      4. Required validation is unaffected — Clearing the date field entirely will still trigger the required field error as before.

      Please test the attached sample.

      Kind Regards,
      Arkan Ahmedov
      Infragistics

      Attachments:
  • 0
    Rohit Rawat
    Rohit Rawat answered on Mar 6, 2026 3:57 AM

    Hello arkan,

    Thank for the help its working fine. I have one doubt when i declare min max like below:

    {
    columnKey: “action_date”,
    editorType: “datepicker”,
    required: true,
    editorOptions: {
    dateInputFormat: “yyyy-MM-dd”,
    valueFormat: “date”, // Keeps value as Date object
    datepickerOptions: {
    changeMonth: true,
    changeYear: true,
    minDate: “-3M”, // 3 months before today
    maxDate: 0 // today
    },

    then its working fine and not giving validation for out of range dates and its also disabling the out of range dates. But, when i do the below

    minDate: new Date(),
    maxDate: (function () {
    let d = new Date();
    d.setFullYear(d.getFullYear() + 1);
    return d;
    })()

    then again its giving validation error when editing a row with out of range date. I need to understand this behaviour is possible.

    Thank you for your help.
    Regards
    Rohit Rawat

    <p data-start=”539″ data-end=”769″></p>

    • 0
      Arkan Ahmedov
      Arkan Ahmedov answered on Mar 6, 2026 8:16 AM

      Hello Rohit,

      Thank you for the detailed observation. You have actually identified a well-known behavioural difference in how igDatePicker handles the two formats internally. Allow me to explain:

      Why the two approaches behave differently:

      When minDate/maxDate are set using jQuery UI relative strings or integer offsets (e.g. “-3M”, 0, “+3M”), they are processed entirely by the jQuery UI datepicker widget itself. Their sole effect is visual — dates outside the range are greyed out and unclickable in the calendar popup. igDatePicker does not intercept these values and they are never forwarded to igValidator.

      When minDate/maxDate are set using JavaScript Date objects, igDatePicker detects them and internally maps them to minValue/maxValue on the igValidator instance attached to that column. This means igValidator will evaluate every cell value — including existing legacy dates — against those bounds at validation time, which is what causes the out-of-range error you are seeing when editing an existing row.

      In summary:

      Format: String (“-3M”) / Integer (0)
      Calendar disabling: Yes
      igValidator range check: No

      Format: new Date(…) object
      Calendar disabling: Yes
      igValidator range check: Yes — causes the error

      Recommendation:

      To achieve calendar-only disabling without triggering igValidator’s built-in range check on legacy values, use the string or integer offset format exclusively for minDate/maxDate:

      `js
      datepickerOptions: {
      changeMonth: true,
      changeYear: true,
      minDate: 0, // today
      maxDate: “+3M” // today + 3 months
      }
      `

      This way:

      jQuery UI recalculates “today” every time the calendar opens (dynamic window).
      No Date objects are passed, so igDatePicker doesn’t wire them into igValidator.

      Best Regards,
      Arkan Ahmedov
      Infragistics

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Rohit Rawat
Favorites
0
Replies
5
Created On
Mar 03, 2026
Last Post
7 months, 1 week ago

Suggested Discussions

Created by

Created on

Mar 3, 2026 1:22 PM

Last activity on

Mar 13, 2026 6:58 AM