icu4x
icu4x copied to clipboard
Fix string parsing of DateTime strings for 1.0
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 to document that the string parsing APIs may be replaced in the future.
The string parsing APIs can be found here
https://unicode-org.github.io/icu4x-docs/doc/icu_datetime/mock/index.html
- @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
https://github.com/unicode-org/icu4x/issues/2241