Open systemcatch opened 3 years ago
Hello, I am interested in implementing this. After reading the arrow.get() API, I still find the description ambiguous. Can you elaborate on "which side of an ambiguous datetime"? Are both tzinfo="US/Pacific", fold=1 new features and what does fold=1 mean? thanks. @systemcatch
@systemcatch Hello I saw this stackoverflow post regarding fold. Fold is related to ambiguous local time due to reasons like local time change. Is this what you mean by fold? https://stackoverflow.com/questions/43359227/python-3-6-local-time-disambiguation-pep-495
Hi @yiransii that is exactly what I meant by fold.
@systemcatch Hello Chris,
I traced back to the get()
method, and it points to the arrow constructor
when there are more than 3 args.
https://github.com/arrow-py/arrow/blob/1278a21b46fcf145592f15b47a8169f97f54415a/arrow/factory.py#L250
I am wondering if we are still updating the enfold method in the arrow constructor? https://github.com/arrow-py/arrow/blob/1278a21b46fcf145592f15b47a8169f97f54415a/arrow/arrow.py#L93
Thanks!
Hey @yiransii for now we can stick with the enfold
method. We just need to make sure that the fold kwarg is handled correctly in the get()
method (https://github.com/arrow-py/arrow/blob/master/arrow/factory.py#L146).
hey @systemcatch,
What output are we expecting for your example command:
arrow.get("2001-10-28 01:00:00", "YYYY-MM-DD HH:mm:ss", tzinfo="US/Pacific", fold=1)
@sania-dsouza we would expect the following.
>>> arrow.Arrow(2001, 10, 28, 1, tzinfo="US/Pacific")
<Arrow [2001-10-28T01:00:00-07:00]>
>>> arrow.Arrow(2001, 10, 28, 1, tzinfo="US/Pacific", fold=1)
<Arrow [2001-10-28T01:00:00-08:00]>
Hello @systemcatch I've opened a pull request for the feature.
BTW, this notation was already working, since all the arguments would be passed into Arrow constructor 🙃
@sania-dsouza we would expect the following.
>>> arrow.Arrow(2001, 10, 28, 1, tzinfo="US/Pacific") <Arrow [2001-10-28T01:00:00-07:00]> >>> arrow.Arrow(2001, 10, 28, 1, tzinfo="US/Pacific", fold=1) <Arrow [2001-10-28T01:00:00-08:00]>
Currently there is no way to specify which side of an ambiguous datetime we want when creating with
arrow.get()
. It'd be nice to be able to do the following.