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

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.

主站蜘蛛池模板: 江孜县| 淄博市| 宁武县| 牡丹江市| 潞城市| 扶沟县| 富蕴县| 图们市| 青海省| 宁晋县| 岢岚县| 丹江口市| 白朗县| 兴海县| 阿拉善左旗| 巍山| 新和县| 阜新市| 东港市| 盐山县| 景谷| 九寨沟县| 崇礼县| 汽车| 迭部县| 泗洪县| 洮南市| 科尔| 肃北| 罗定市| 阳信县| 龙陵县| 丹棱县| 正阳县| 鄂尔多斯市| 罗源县| 定日县| 淮北市| 嵩明县| 含山县| 长乐市|