Open Swizzler121 opened 2 years ago
Ran the example code on my windows system just to show it's not one particular environment:
sample 1 Fetched date short, (date should be a Wednesday): 0001-01-01T00:00:00+00:00
sample 2 Fetched date long (date should be a Sunday): 1989-01-01T00:00:00+00:00
sample 1 Formatted long (should be the word Wednesday): Monday
sample 2 Formatted short (should be 7 for Sunday): 7
sample 2 Formatted long (should be the word Sunday): 7
Hey @Swizzler121 when I try your second example I get the following result.
>>> dt=arrow.get('198911', 'YYYYMD')
>>> dt
<Arrow [1989-01-01T00:00:00+00:00]>
>>> dt.format("d")
'7'
>>> dt.format("dddd")
'Sunday'
I think wkday2
is being overridden at some point.
For the first example I can see the bug, @jadchaar I think we worked on this at one point?
Issue Description
When formatting from a date as an integer, it does not always translate correctly.
example code:
example output:
Sample 1: Single digit input As you can see, when using arrow.get to fetch day of the week as an integer, no matter what number you give it, it instead grabs the date of 0001-01-01 which is a Sunday, but then more confusingly, it formats 0001-01-01 as a Monday, so I assume it's just seeing 1, even though it was originally fed a 3.
Sample 2: Valid date input While you can convert a valid date to day of the week then again down to a number 1-7 Mon-Sun, you cannot then convert back from a number to a day of the week again.
System Info