- Dart:Scalable Application Development
- Davy Mitchell Sergey Akopkokhyants Ivo Balbaert
- 111字
- 2021-07-09 18:56:18
Adding a date
Most presentations are usually dated, or at least some of the jokes are! We will add a convenient button for the user to add a date to the presentation using the HTML5 input type date, which provides a graphical date picker:
<input type="date" id="selDate" value="2000-01-01"/>
The default value is set in the index.html
page as follows:

The valueAsDate
property of the DateInputElement
class provides the Date
object, which can be added to the text area:
void insertDate(Event event) { DateInputElement datePicker = querySelector("#selDate"); if (datePicker.valueAsDate != null) presEditor.value =presEditor.value + datePicker.valueAsDate.toLocal().toString(); }
In this case, the toLocal
method is used to obtain a string formatted to the month, day, and year format.
推薦閱讀
- 大話PLC(輕松動漫版)
- Deploying Node.js
- DBA攻堅指南:左手Oracle,右手MySQL
- 從零開始:數字圖像處理的編程基礎與應用
- R語言經典實例(原書第2版)
- 深度學習經典案例解析:基于MATLAB
- Getting Started with ResearchKit
- Java Web開發之道
- 3D少兒游戲編程(原書第2版)
- 快速念咒:MySQL入門指南與進階實戰
- Mastering JBoss Enterprise Application Platform 7
- Python編程從0到1(視頻教學版)
- Spring核心技術和案例實戰
- Android Development Tools for Eclipse
- 深入分析GCC