icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Fix string parsing of DateTime strings for 1.0

Open sffc opened this issue 3 years ago • 2 comments
trafficstars

For ICU4X 1.0, we need a quick solution for how to get from strings to DateTime objects. This solution should be forward-compatible with https://github.com/unicode-org/icu4x/issues/2240.

sffc avatar Jul 25 '22 15:07 sffc

@sffc to document that the string parsing APIs may be replaced in the future.

sffc avatar Jul 28 '22 18:07 sffc

The string parsing APIs can be found here

https://unicode-org.github.io/icu4x-docs/doc/icu_datetime/mock/index.html

sffc avatar Aug 03 '22 14:08 sffc

  • @sffc - These functions are bad because they are not correct for parsing ISO strings. There are valid ISO strings that people can pass to these functions which will produce strange or unexpected behavior. Further, it is not correct to parse ISO strings to a Gregorian DateTime; they should at least pass through the ISO calendar first.
  • @sffc - I observe that we are not using these except in a couple examples and in tests/benches.

Conclusion: Remove these functions, move them into the test/bench modules if they are needed there, and update all public examples to use the nicer constructors. If we need const-construction, store a 6-tuple and manually call the constructor at runtime.

LGTM: @echeran, @Manishearth

sffc avatar Aug 11 '22 18:08 sffc

https://github.com/unicode-org/icu4x/issues/2241

Manishearth avatar Aug 22 '22 23:08 Manishearth