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

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.

主站蜘蛛池模板: 门头沟区| 富顺县| 渑池县| 扶绥县| 平和县| 托克逊县| 固镇县| 阿合奇县| 牡丹江市| 皋兰县| 沭阳县| 丁青县| 石楼县| 达州市| 千阳县| 黔南| 根河市| 柳江县| 申扎县| 达孜县| 青川县| 华宁县| 枣阳市| 雷山县| 株洲县| 浦县| 南乐县| 巴林左旗| 尼勒克县| 墨脱县| 盐亭县| 孙吴县| 都安| 多伦县| 乡城县| 临沭县| 北川| 东安县| 广德县| 班戈县| 四子王旗|