Google Chrome input type=“date”

前端 未结 4 2051
广开言路
广开言路 2021-02-20 17:26

I have almost no knowledge of web programming, but I have been tasked to solve something on my company\'s website. Apparently, I have an issue with browsers using HTML5 on a le

相关标签:
4条回答
  • 2021-02-20 17:55

    Actually chrome's support for 'date' is broken. (See here). At least for the moment.

    The use of 'date' in the HTML is absolutely fine - browser's which do not know of or support an input type are supposed to fallback to type='text'.

    Currently chrome partially supports date, in a way that is essentially broken (it adds a couple of up-down buttons, but no datepicker.)

    Of course you do need to bear in mind that if you are using type='date', and if the browser supports it, then you'll want to disable whatever datepicker support you'd otherwise be using.

    UPDATE (6 Feb 2012):

    It looks to me like this is now fixed. Chrome no longer claims to support input type='date', and does not provide the partially complete implementation.

    UPDATE (17 Aug 2012):

    Chrome does now have input type="date" support, and it's more functional this time.

    0 讨论(0)
  • 2021-02-20 17:58

    The value field for the input type = input needs to be in the format yyyy-MM-dd. Check the W3 standards on this.

    This means you must do something like DateTime.Now.ToString("yyyy-MM-dd"). in your code, I would suggest a custom HtmlHelper.

    The format of the date in the browser is completely dependent on your system settings.

    0 讨论(0)
  • 2021-02-20 17:59

    Chrome does not have issues with date-inputs, you are using the wrong date-format, sir. Chrome isn't the only browser until today which has support for the new HTML5 inputs. Opera for example displays a dropdown with a calendar on inputs with type="date".

    Also the size-attribute does not exist on HTML5-date-inputs.

    0 讨论(0)
  • 2021-02-20 18:02

    Use this date format : date("Y-m-d");

    0 讨论(0)
提交回复
热议问题