<?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: Best way to have a list view of dates that are the beginning pay periods in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232171#M1194153</link>
    <description>&lt;P&gt;Ok &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/336477"&gt;@Adam Peterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Got it ! Below &lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_down:"&gt;👇&lt;/span&gt; script should work&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (isLoading || newValue === '') return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var selectedDate = new Date(newValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var day = selectedDate.getDay(); // 0 = Sunday&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (day !== 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.showFieldMsg('your_date_field', 'Please select a Sunday.', 'error');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('your_date_field', '');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; // Base Sunday: April 6, 2025&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var baseSunday = new Date('2025-04-06');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var diffTime = selectedDate.getTime() - baseSunday.getTime();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (diffDays % 14 !== 0 || diffDays &amp;lt; 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.showFieldMsg('your_date_field', 'Please select an alternate Sunday starting from April 6, 2025.', 'error');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('your_date_field', '');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.hideFieldMsg('your_date_field', true);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please change the field names accordingly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with - 2025-04-13 - didn't accept&amp;nbsp;&lt;/P&gt;&lt;P&gt;2025-04-27 - didn't accept&amp;nbsp;&lt;/P&gt;&lt;P&gt;2025-05-18 - accepted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Shivalika&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My LinkedIn - &lt;A href="https://www.linkedin.com/in/shivalika-gupta-540346194" target="_blank"&gt;https://www.linkedin.com/in/shivalika-gupta-540346194&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My youtube - &lt;A href="https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY" target="_blank"&gt;https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Apr 2025 21:16:24 GMT</pubDate>
    <dc:creator>Shivalika</dc:creator>
    <dc:date>2025-04-08T21:16:24Z</dc:date>
    <item>
      <title>Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232143#M1194142</link>
      <description>&lt;P&gt;I am in need of a way to have them select a date but they are only allowed to select the first day of a pay period. So pretty much I need to display every other Sunday.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I use a date field? Should I populate a select box? What's the best way to approach this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 20:38:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232143#M1194142</guid>
      <dc:creator>Adam Peterson</dc:creator>
      <dc:date>2025-04-08T20:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232156#M1194145</link>
      <description>&lt;P&gt;Hello &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/336477"&gt;@Adam Peterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use below &lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_down:"&gt;👇&lt;/span&gt; on change client script - it would work on birth catalog form and normal form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (isLoading || newValue === '') return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var selectedDate = new Date(newValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var day = selectedDate.getDay(); // 0 = Sunday&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (day !== 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.showFieldMsg('your_date_field', 'Please select a Sunday.', 'error');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('your_date_field', '');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.hideFieldMsg('your_date_field', true&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;I tested with these dates - 2025-04-13 (which is a Sunday)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System Behavior:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field value is accepted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)2025-04-14 (which is a Monday)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System Behavior:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error shown: "Please select a Sunday."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field value is cleared automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Shivalika&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My LinkedIn - &lt;A href="https://www.linkedin.com/in/shivalika-gupta-540346194" target="_blank"&gt;https://www.linkedin.com/in/shivalika-gupta-540346194&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My youtube - &lt;A href="https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY" target="_blank"&gt;https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 20:52:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232156#M1194145</guid>
      <dc:creator>Shivalika</dc:creator>
      <dc:date>2025-04-08T20:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232163#M1194148</link>
      <description>&lt;P&gt;Oh that's good. But I need every OTHER sunday depending when the pay period starts.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:01:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232163#M1194148</guid>
      <dc:creator>Adam Peterson</dc:creator>
      <dc:date>2025-04-08T21:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232164#M1194149</link>
      <description>&lt;P&gt;OTHER - you mean alternative ? &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/336477"&gt;@Adam Peterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Shivalika&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My LinkedIn - &lt;A href="https://www.linkedin.com/in/shivalika-gupta-540346194" target="_blank"&gt;https://www.linkedin.com/in/shivalika-gupta-540346194&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My youtube - &lt;A href="https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOw" target="_blank"&gt;https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOw&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;EM&gt;&lt;STRONG&gt;NeEISQCY&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:05:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232164#M1194149</guid>
      <dc:creator>Shivalika</dc:creator>
      <dc:date>2025-04-08T21:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232165#M1194150</link>
      <description>&lt;P&gt;And that too depending on pay period &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/336477"&gt;@Adam Peterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that would be very dynamic. If there is some fixed pattern we could still cone up with script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then maybe it's better off as a select box field where you give options. If you some fixed pattern let me know could try to come up with a script otherwise select box is fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Shivalika&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My LinkedIn - &lt;A href="https://www.linkedin.com/in/shivalika-gupta-540346194" target="_blank"&gt;https://www.linkedin.com/in/shivalika-gupta-540346194&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My youtube - &lt;A href="https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY" target="_blank"&gt;https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:07:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232165#M1194150</guid>
      <dc:creator>Shivalika</dc:creator>
      <dc:date>2025-04-08T21:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232167#M1194151</link>
      <description>&lt;P&gt;We could start with 4/6/25 and then every two weeks after that.&lt;BR /&gt;&lt;BR /&gt;4/6/25&lt;BR /&gt;4/20/25&lt;BR /&gt;5/4/25&lt;BR /&gt;5/18/25&lt;BR /&gt;etc&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:11:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232167#M1194151</guid>
      <dc:creator>Adam Peterson</dc:creator>
      <dc:date>2025-04-08T21:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232171#M1194153</link>
      <description>&lt;P&gt;Ok &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/336477"&gt;@Adam Peterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Got it ! Below &lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_down:"&gt;👇&lt;/span&gt; script should work&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (isLoading || newValue === '') return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var selectedDate = new Date(newValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var day = selectedDate.getDay(); // 0 = Sunday&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (day !== 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.showFieldMsg('your_date_field', 'Please select a Sunday.', 'error');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('your_date_field', '');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; // Base Sunday: April 6, 2025&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var baseSunday = new Date('2025-04-06');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var diffTime = selectedDate.getTime() - baseSunday.getTime();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (diffDays % 14 !== 0 || diffDays &amp;lt; 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.showFieldMsg('your_date_field', 'Please select an alternate Sunday starting from April 6, 2025.', 'error');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('your_date_field', '');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.hideFieldMsg('your_date_field', true);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please change the field names accordingly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with - 2025-04-13 - didn't accept&amp;nbsp;&lt;/P&gt;&lt;P&gt;2025-04-27 - didn't accept&amp;nbsp;&lt;/P&gt;&lt;P&gt;2025-05-18 - accepted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Shivalika&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My LinkedIn - &lt;A href="https://www.linkedin.com/in/shivalika-gupta-540346194" target="_blank"&gt;https://www.linkedin.com/in/shivalika-gupta-540346194&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;My youtube - &lt;A href="https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY" target="_blank"&gt;https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&amp;amp;si=0WynLcOwNeEISQCY&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:16:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232171#M1194153</guid>
      <dc:creator>Shivalika</dc:creator>
      <dc:date>2025-04-08T21:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to have a list view of dates that are the beginning pay periods</title>
      <link>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232180#M1194156</link>
      <description>&lt;P&gt;I like it! Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:50:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/best-way-to-have-a-list-view-of-dates-that-are-the-beginning-pay/m-p/3232180#M1194156</guid>
      <dc:creator>Adam Peterson</dc:creator>
      <dc:date>2025-04-08T21:50:03Z</dc:date>
    </item>
  </channel>
</rss>

