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

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.

主站蜘蛛池模板: 齐河县| 盘锦市| 土默特左旗| 汉寿县| 兴业县| 六枝特区| 北碚区| 理塘县| 东明县| 济南市| 武乡县| 南华县| 永定县| 称多县| 林芝县| 都江堰市| 岑巩县| 通许县| 铁力市| 海门市| 英德市| 本溪市| 崇州市| 平乐县| 四平市| 富源县| 黑河市| 玉环县| 瓮安县| 新和县| 馆陶县| 启东市| 阿坝| 武强县| 福清市| 吉首市| 陆河县| 什邡市| 龙口市| 咸丰县| 徐闻县|