script: Use time@0.3 for input elements and do conversion in a &str trait (#33355)

This changes converts all input element parsing and normalization to use
`time` instead of `chrono`. `time` is used by our dependencies, so it
makes sense to work toward removing the Servo dependency on chrono.

In addition, parsing and normalization also moves to a trait on &str to
prepare for the possibility of all script parsers moving to a separate
crate that can have unit tests written against it.

Code duplication is eliminated when possible and more conversion is done
using integer types. These two things together mean we pass more tests
now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-09-09 07:33:16 -07:00 committed by GitHub
parent 687f356db9
commit 8842fe9df5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 528 additions and 482 deletions

View file

@ -1,9 +0,0 @@
[input-valueasdate.html]
[valueAsDate setter on type time (new Date("1970-01-01T00:00:00.000Z"))]
expected: FAIL
[valueAsDate setter on type time (new Date("1970-01-01T12:00:00.000Z"))]
expected: FAIL
[valueAsDate setter on type time (new Date("1970-01-01T23:59:00.000Z"))]
expected: FAIL

View file

@ -1,9 +0,0 @@
[input-valueasnumber.html]
[valueAsNumber setter on type time (actual valueAsNumber: 86340000, expected value: 23:59)]
expected: FAIL
[valueAsNumber setter on type time (actual valueAsNumber: 43200000, expected value: 12:00)]
expected: FAIL
[valueAsNumber setter on type time (actual valueAsNumber: 0, expected value: 00:00)]
expected: FAIL