官术网_书友最值得收藏!

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:

Adding a date

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.

主站蜘蛛池模板: 肥城市| 通州区| 田东县| 榆树市| 徐州市| 甘德县| 尼木县| 吴堡县| 墨江| 高雄县| 韩城市| 甘洛县| 肥城市| 图木舒克市| 泰来县| 塔城市| 郯城县| 思茅市| 郯城县| 舟山市| 罗江县| 巴彦县| 高淳县| 赞皇县| 肥乡县| 灵璧县| 溆浦县| 绵阳市| 江门市| 咸丰县| 枣阳市| 都匀市| 惠来县| 定安县| 岳西县| 红桥区| 千阳县| 麻江县| 河池市| 广汉市| 察雅县|