diff options
Diffstat (limited to 'files/ja/web/api/file/lastmodifieddate/index.md')
-rw-r--r-- | files/ja/web/api/file/lastmodifieddate/index.md | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/files/ja/web/api/file/lastmodifieddate/index.md b/files/ja/web/api/file/lastmodifieddate/index.md new file mode 100644 index 0000000000..2bae6e492c --- /dev/null +++ b/files/ja/web/api/file/lastmodifieddate/index.md @@ -0,0 +1,85 @@ +--- +title: File.lastModifiedDate +slug: Web/API/File/lastModifiedDate +tags: + - API + - File + - File API + - lastModifiedDate + - ファイル + - プロパティ + - リファレンス + - 読み取り専用 + - 非推奨 +translation_of: Web/API/File/lastModifiedDate +--- +<div> +<p>{{APIRef("File API") }} {{deprecated_header}}</p> + +<p><code><strong>File.lastModifiedDate</strong></code><strong> </strong>読み取り専用プロパティは、ファイルの最終更新日を返します。最終更新日がわからないファイルは、現在の日付を返します。</p> + +<h2 id="構文">構文</h2> + +<pre class="line-numbers language-html notranslate"><code class="language-html">var time = instanceOfFile.lastModifiedDate</code></pre> + +<h3 id="値">値</h3> + +<p>ファイルが最後に変更された日時を示す <code><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Date">Date</a></code> オブジェクトです。</p> + +<h2 id="Example" name="Example">例</h2> + +<pre class="brush:js notranslate">var fileInput = document.getElementById("myfileinput"); +// fileInput は HTMLInputElement オブジェクトを参照するものとする: <input type="file" multiple id="myfileinput"> + +var files = fileInput.files; +// files は (NodeList に似た) FileList オブジェクトを参照 + +for (var i = 0; i < files.length; i++) { + alert( + files[i].name + + " (最終更新日: " + + files[i].lastModifiedDate + + ")" + ); +} +</pre> + +<h2 id="短縮された時間精度">短縮された時間精度</h2> + +<p>タイミング攻撃やフィンガープリンティングに対する保護機能を提供するため、<code>someFile.lastModifiedDate.getTime()</code> の精度がブラウザの設定に応じて丸められることがあります。</p> + +<p>Firefox では、<code>privacy.reduceTimerPrecision</code> 設定はデフォルトで有効になっており、Firefox 59 ではデフォルトで 20 us に設定されています。60 で 2 ms になります。</p> + +<pre class="brush: js line-numbers language-js notranslate"><code class="language-js"><span class="comment token">// reduced time precision (2ms) in Firefox 60</span> +someFile<span class="punctuation token">.</span>lastModifiedDate<span class="punctuation token">.</span><span class="function token">getTime</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="comment token">// 1519211809934</span> +<span class="comment token">// 1519211810362</span> +<span class="comment token">// 1519211811670</span> +<span class="comment token">// ...</span> + + +<span class="comment token">// reduced time precision with `privacy.resistFingerprinting` enabled</span> +someFile<span class="punctuation token">.</span>lastModifiedDate<span class="punctuation token">.</span><span class="function token">getTime</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="comment token">// 1519129853500</span> +<span class="comment token">// 1519129858900</span> +<span class="comment token">// 1519129864400</span> +<span class="comment token">// ...</span></code></pre> + +<p>Firefox では、<code>privacy.resistFingerprinting</code> を有効にすることもできます。精度は 100 ms か <code>privacy.resistFingerprinting.reduceTimerPrecision.microseconds</code> のいずれか大きい方の値になります。</p> + +<h2 id="仕様">仕様</h2> + +<p><em>File API 仕様の初期のドラフトにありますが、このプロパティは削除されており、現在は非標準です。代わりに{{domxref("File.lastModified")}} を使用してください。</em></p> + +<h2 id="ブラウザの互換性">ブラウザの互換性</h2> + +<div> +<p>{{Compat("api.File.lastModifiedDate")}}</p> +</div> + +<h2 id="あわせて参照">あわせて参照</h2> + +<ul> + <li>{{domxref("File")}}</li> +</ul> +</div> |