<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Allow past date in date/time field in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487875#M1247138</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this should work fine&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_0-1770899734838.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501380i7949C3A4320B0264/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_0-1770899734838.png" alt="AnkurBawiskar_0-1770899734838.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_1-1770899800825.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501381i983ED5EFB77E9D2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_1-1770899800825.png" alt="AnkurBawiskar_1-1770899800825.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Feb 2026 12:36:49 GMT</pubDate>
    <dc:creator>Ankur Bawiskar</dc:creator>
    <dc:date>2026-02-12T12:36:49Z</dc:date>
    <item>
      <title>Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487832#M1247126</link>
      <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm struggling with creating the date/time field where only the past dates are allowed.&amp;nbsp; I found this code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martines_0-1770898724144.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501351i038F28E7C4BE7EC2/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Martines_0-1770898724144.png" alt="Martines_0-1770898724144.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But it doesn't work. The accepted behavior is that user is not able to choose from the date/time component the future dates. (This would be happy case) Or at least when user choose date in future he will get the message that future dates are not allowed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any suggestions? Thank you in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:20:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487832#M1247126</guid>
      <dc:creator>Martines</dc:creator>
      <dc:date>2026-02-12T12:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487866#M1247135</link>
      <description>&lt;P&gt;Same ui policy, but update the text in the script. The condition should be 'start date relative after 1 minute ago' or something similar.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:29:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487866#M1247135</guid>
      <dc:creator>Mark Manders</dc:creator>
      <dc:date>2026-02-12T12:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487870#M1247137</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the onChange client script for that :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-02-12 180100.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501379iA858D56015B70AB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-02-12 180100.png" alt="Screenshot 2026-02-12 180100.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script :&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //Type appropriate comment here, and begin script below

    var currentDate = new Date();
    var selectedDate = new Date(newValue);

    if (selectedDate.valueOf() &amp;gt; currentDate.valueOf()) {
        g_form.addErrorMessage('Future dates are not allowed. Please select a past date.');
        g_form.clearValue('your_date_field');
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If my response helped mark as helpful and accept the solution.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:34:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487870#M1247137</guid>
      <dc:creator>yashkamde</dc:creator>
      <dc:date>2026-02-12T12:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487875#M1247138</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this should work fine&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_0-1770899734838.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501380i7949C3A4320B0264/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_0-1770899734838.png" alt="AnkurBawiskar_0-1770899734838.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_1-1770899800825.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501381i983ED5EFB77E9D2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_1-1770899800825.png" alt="AnkurBawiskar_1-1770899800825.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:36:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487875#M1247138</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-02-12T12:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487883#M1247143</link>
      <description>&lt;P&gt;thank you for your answer. And if I have more fields where I need to apply this? I don't want to create like 6 ciient scripts for each field I would like to have like on function for that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:41:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487883#M1247143</guid>
      <dc:creator>Martines</dc:creator>
      <dc:date>2026-02-12T12:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487897#M1247149</link>
      <description>&lt;P&gt;Create a Client Script:&lt;/P&gt;&lt;P&gt;Type is Onchange and field is start_date_time&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2026-02-12 181349.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501387iEB8DC5C09B29BF3C/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-02-12 181349.png" alt="Screenshot 2026-02-12 181349.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How It works&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Gets selected date&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Compares with current date/time&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 12:47:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487897#M1247149</guid>
      <dc:creator>Hemanth EK</dc:creator>
      <dc:date>2026-02-12T12:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487982#M1247169</link>
      <description>&lt;P&gt;Client scripts work on the fields themselves, so you will need one for every field. But it makes no sense. You can do this with ui policies.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 13:42:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487982#M1247169</guid>
      <dc:creator>Mark Manders</dc:creator>
      <dc:date>2026-02-12T13:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487983#M1247170</link>
      <description>&lt;P&gt;I did it this way:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Created UI policy:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martines_0-1770903671745.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501403iBBB84E5BA1EEE68A/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Martines_0-1770903671745.png" alt="Martines_0-1770903671745.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Where I include every field that needs to be checked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Than in script I made the if statements:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martines_2-1770903740582.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/501407i44CA584AE4C48C5F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Martines_2-1770903740582.png" alt="Martines_2-1770903740582.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I know that it can be simplified with for loop &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 13:43:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3487983#M1247170</guid>
      <dc:creator>Martines</dc:creator>
      <dc:date>2026-02-12T13:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488001#M1247172</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your script won't help user to know which field actually was having invalid value.&lt;/P&gt;
&lt;P&gt;If Start date is invalid then it will show error message besides all fields.&lt;/P&gt;
&lt;P&gt;You will require separate UI policies for each field&lt;/P&gt;
&lt;P&gt;Logic I already shared&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 13:55:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488001#M1247172</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-02-12T13:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488079#M1247179</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did my approach work for you?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2026 15:35:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488079#M1247179</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-02-12T15:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Allow past date in date/time field</title>
      <link>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488407#M1247228</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/881256"&gt;@Martines&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create those many individual UI policies on each field&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;create 1 onSubmit and validate all the fields and whichever fields are invalid show field message error near that&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2026 03:24:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/allow-past-date-in-date-time-field/m-p/3488407#M1247228</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-02-13T03:24:57Z</dc:date>
    </item>
  </channel>
</rss>

