gpt4 book ai didi

kendo-ui - KendoDatePicker 多种格式

转载 作者:行者123 更新时间:2023-12-01 09:58:32 25 4
gpt4 key购买 nike

KendoDatePicker如何接受多种格式?

例如,声明与此类似的多种格式(如果格式接受数组)。

this.$('#dtToDate').kendoDatePicker({
value: new Date(),
min: new Date(1950, 0, 1),
max: new Date(2049, 11, 31),
format: ["MM-dd-yyyy", "MM/dd/yyyy"]
});

为了接受格式为 12-10-2013 或 12/10/2013 的日期。

最佳答案

您正在寻找的是 parseFormat。格式只接受 1 个值。

parseFormat 是一个数组

Specifies the formats, which are used to parse the value set with value() method or by direct input. If not set the value of the options.format and options.timeFormat will be used. Note that value of the format option is always used

引用资料 http://docs.kendoui.com/api/web/datetimepicker#configuration-parseFormats

和 jsfiddle 示例

$("#sampleDate").kendoDatePicker({
format: "MM-dd-yyyy",
parseFormats: ["MM-dd-yyyy", "MM/dd/yyyy"]
});

http://jsfiddle.net/85DUe/

该示例将接受 MM-dd-yyyy 和 MM/dd/yyyy 中的值,并将它们转换为以 MM-dd-yyyy 格式指定的值

关于kendo-ui - KendoDatePicker 多种格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20509929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com