指定 HTML5 输入类型 = 日期的值输出? [英] Specifying the value output of of an HTML5 input type = date?

查看:32
本文介绍了指定 HTML5 输入类型 = 日期的值输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将本机日期选择器添加到我的应用程序中,该应用程序目前使用的是传统的家庭滚动系统.日期输入支持尚不普遍,但如果我可以根据兼容性来展示这两种实现,那就太理想了.

I'd like to add native date pickers to my application, which currently uses a legacy, home-rolled system. Date input support isn't widespread, yet, but if I could present both implementations based on compatibility, that would be ideal.

有没有办法指定 HTML 日期选择器给出的值的输出?歌剧的默认值是yyyy-mm-dd,我非常明确地需要dd-MMM-yyyy.

Is there any way to specify the output of the value given by an HTML datepicker? The default for opera is yyyy-mm-dd, and I very explicitly need dd-MMM-yyyy.

目前有没有办法控制这个输出?

Is there any way to control this output, currently?

推荐答案

HTML5 日期输入 字段特定于它使用的格式:RFC 3339 完整日期

The HTML5 date input field is specific about the format it uses: RFC 3339 full-date

是否可以将旧日期选择器更改为使用 yyyy-mm-dd 格式(并更新读取该格式的服务器端)?

Is it possible to change the legacy date picker to use yyyy-mm-dd format (and update the server side that reads that)?

我认为不是,所以您可以添加一些 Javascript 粘合代码来侦听 HTML5 输入上的更改事件并更新隐藏的日期值字段以匹配旧日期选择器的格式(将 yyyy-mm-dd 转换为dd-MMM-yyyy).

I assume not, so then you can add some Javascript glue code that listens for a change event on the HTML5 input and updates a hidden date value field to match the format of the legacy date picker (converts yyyy-mm-dd to dd-MMM-yyyy).

这篇关于指定 HTML5 输入类型 = 日期的值输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆