<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JS: Непонятная ошибка.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16297&amp;type=atom" />
	<updated>2021-04-28T23:26:35Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16297</id>
		<entry>
			<title type="html"><![CDATA[Re: JS: Непонятная ошибка.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147545#p147545" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Мальчик-гей]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30832</uri>
			</author>
			<updated>2021-04-28T23:26:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147545#p147545</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[JS: Непонятная ошибка.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147533#p147533" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[SuBrex]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40829</uri>
			</author>
			<updated>2021-04-28T17:33:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147533#p147533</id>
		</entry>
</feed>
