w3c / w3c/webdriver

Lack of normalisation in date formats

Open
#1,470 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Element Send Keys enhancement
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

This is a bit of a weird one, so apologies in advance.

In chapter E. Index:

Date state
Local Date and Time state

The display format for the date, and local date and time, input types is left to be implementation specific, meanwhile the value attribute is always normalised to dd-mm-yyyy.
The lack of standardisation makes it difficult to set the value using the element-send-keys endpoint (https://www.w3.org/TR/webdriver/#dfn-element-send-keys) as the keys sent mimic the display format.

As an example, if I set the value of a date element to 2012-12-25 I can do so successfully on Firefox, but Chrome uses a different date format of dd/mm/yyyy for display. As a result my attempt to set the value leads to a garbage result of 1225-12-20.

I feel that there should be some part of the spec which dictates that the accepted values must be normalised in some way.

In the current state it is not possible to write a cross-browser way of setting the date using the sendKeys endpoint.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebDriver specification's E. Index chapter, especially Date state and Local Date and Time state, then review the element-send-keys endpoint. Compare the stated value normalization with the Firefox and Chrome behavior described here. Done means the specification defines an interoperable accepted format for date inputs so send-keys can set the same value cross-browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.