<?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>topic Date setMonth function Calculation result error in Discussions</title>
    <link>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4490#M1995</link>
    <description>&lt;P&gt;var d2=new Date("Thu Mar 31 2022 00:00:00");//2022-03-31&lt;BR /&gt;d2.setMonth(3);//set April&amp;nbsp;&lt;BR /&gt;console.log(d2);//Become May&amp;nbsp; 2022-05-01&lt;BR /&gt;&lt;BR /&gt;Output result:&lt;BR /&gt;Sun May 01 2022 00:00:00 GMT+0800 (中国标准时间)&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 03:00:53 GMT</pubDate>
    <dc:creator>xiaoyu2022</dc:creator>
    <dc:date>2022-04-19T03:00:53Z</dc:date>
    <item>
      <title>Date setMonth function Calculation result error</title>
      <link>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4490#M1995</link>
      <description>&lt;P&gt;var d2=new Date("Thu Mar 31 2022 00:00:00");//2022-03-31&lt;BR /&gt;d2.setMonth(3);//set April&amp;nbsp;&lt;BR /&gt;console.log(d2);//Become May&amp;nbsp; 2022-05-01&lt;BR /&gt;&lt;BR /&gt;Output result:&lt;BR /&gt;Sun May 01 2022 00:00:00 GMT+0800 (中国标准时间)&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 03:00:53 GMT</pubDate>
      <guid>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4490#M1995</guid>
      <dc:creator>xiaoyu2022</dc:creator>
      <dc:date>2022-04-19T03:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Date setMonth function Calculation result error</title>
      <link>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4494#M1996</link>
      <description>&lt;P&gt;I think I know this one: 31 April 2022 is not a valid date, so Firefox rolls forward to a valid date based on the shortfall of days in the selected month compared with the original month.&lt;/P&gt;&lt;P&gt;Another example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var d2=new Date("Thu Mar 31 2022 00:00:00"); //2022-03-31
d2.setMonth(1); //set February
console.log(d2); //expect 2022-03-03&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;If you need to toll back to the last date of the "set" month in this situation, there probably are good code examples on StackOverflow or other sites for that.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 05:26:19 GMT</pubDate>
      <guid>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4494#M1996</guid>
      <dc:creator>jscher2000</dc:creator>
      <dc:date>2022-04-19T05:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Date setMonth function Calculation result error</title>
      <link>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4495#M1997</link>
      <description>&lt;P&gt;Thank you very much for your advice. I'll try.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 06:04:26 GMT</pubDate>
      <guid>https://connect.mozilla.org/t5/discussions/date-setmonth-function-calculation-result-error/m-p/4495#M1997</guid>
      <dc:creator>xiaoyu2022</dc:creator>
      <dc:date>2022-04-19T06:04:26Z</dc:date>
    </item>
  </channel>
</rss>

