<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; JS: Непонятная ошибка.]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=16297</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16297&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «JS: Непонятная ошибка.».]]></description>
		<lastBuildDate>Wed, 28 Apr 2021 23:26:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: JS: Непонятная ошибка.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=147545#p147545</link>
			<description><![CDATA[<div class="quotebox"><cite>SuBrex пишет:</cite><blockquote><p>The specified value &quot;2021-06-31&quot; does not conform to the required format, &quot;yyyy-MM-dd&quot;.</p></blockquote></div><p>А &quot;2021-06-32&quot;?</p>]]></description>
			<author><![CDATA[null@example.com (Мальчик-гей)]]></author>
			<pubDate>Wed, 28 Apr 2021 23:26:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=147545#p147545</guid>
		</item>
		<item>
			<title><![CDATA[JS: Непонятная ошибка.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=147533#p147533</link>
			<description><![CDATA[<div class="codebox"><pre><code>function AUTOCOMPLETE() {
	let date = new Date(document.getElementById(&#039;DATE1&#039;).value);
	let month = date.getMonth()+1;
	let year = date.getFullYear();
	let sdate = document.getElementById(&#039;DATE2&#039;);
	let tdate = document.getElementById(&#039;DATE3&#039;);
	if (month&lt;10) {
		sdate.value = &#039;year-0month-01&#039;.replace(&#039;year&#039;, year-1).replace(&#039;month&#039;, month);
	} else {sdate.value = &#039;year-month-01&#039;.replace(&#039;year&#039;, year-1).replace(&#039;month&#039;, month);}
	if (month&lt;11) {
		tdate.value = &#039;year-0month-31&#039;.replace(&#039;year&#039;, year).replace(&#039;month&#039;, month-1);
	} else {tdate.value = &#039;year-month-31&#039;.replace(&#039;year&#039;, year).replace(&#039;month&#039;, month-1);}
	if (month==1) {
		month = 12;
		tdate.value = &#039;year-month-31&#039;.replace(&#039;year&#039;, year-1).replace(&#039;month&#039;, month);
	}
}</code></pre></div><p>Вот такая функция. Происходит нечто странное: <br />Если в DATE1 вводить месяцы: 03, 05, 07, 10, 12, то DATE3 капризничает и выдаёт ошибку. Например:<br /></p><div class="codebox"><pre><code>The specified value &quot;2021-06-31&quot; does not conform to the required format, &quot;yyyy-MM-dd&quot;.</code></pre></div><p>Скажите, пожалуйста, как исправить?</p>]]></description>
			<author><![CDATA[null@example.com (SuBrex)]]></author>
			<pubDate>Wed, 28 Apr 2021 17:33:43 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=147533#p147533</guid>
		</item>
	</channel>
</rss>
