在dojo中为选定日期添加4个月并将其显示在文本框中

Adding 4 months to a selected date in dojo and displaying it in a textbox?

本文关键字:显示 文本 添加 dojo 日期 4个      更新时间:2023-09-26

在Dojo javascript中,在日期文本框中输入日期后,如何将4个月添加到所选日期并在文本框中显示?

您可以对dojo执行此操作。日期工具:

var enteredDate  = myDateTextBox.get("value"),
    modifiedDate = dojo.date.add(enteredDate, "month", 4);
myTextBox.set("value", modifiedDate.toUTCString());

假设您有dojo.require("dojo.date");。有关Dojo日期函数的概述,请查看http://dojotoolkit.org/api/1.7/dojo/date。

但是,从技术上讲,根本没有必要为此使用Dojo。Javascript函数为日期添加X个月