naoty / Timepiece

Intuitive date handling in Swift
MIT License
2.63k stars 148 forks source link

inFormat is returning wrong weekday #75

Closed allaire closed 7 years ago

allaire commented 7 years ago

I just debugged an issue I have with .date(inFormat:), it returns the wrong weekday.

I pin pointed the issue to this line:

https://github.com/naoty/Timepiece/blob/master/Sources/String%2BTimepiece.swift#L21

If you remove it, it works as expected (I think it uses the current calendar by default, maybe this line overwrites it).

naoty commented 7 years ago

@allaire Thank you for reporting! I'll debug this soon. Do you use a calendar different from Calendar.current?

allaire commented 7 years ago

No I don't :) Calendar.current is gregorian.

-- Mathieu Allaire

On November 28, 2016 at 20:46:25, Naoto Kaneko (notifications@github.com) wrote:

@allaire https://github.com/allaire Thank you for reporting! I'll debug this soon. Do you use a calendar different from Calendar.current?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/naoty/Timepiece/issues/75#issuecomment-263452165, or mute the thread https://github.com/notifications/unsubscribe-auth/AASlTeS544eWwkxxSRdfe5ONFfF1KGEaks5rC4PwgaJpZM4K917q .

naoty commented 7 years ago

@allaire Though I tried to regenerate this bug with tests, I could not do it. It looks that there are no problems. This line is described here.

Would you send a pull request to regenerate bugs?

allaire commented 7 years ago

@naoty maybe it was caused because the date returned was not in UTC 0 format, and since your method specifically put it in UTC+0, it was changed the day of what I was expecting.

Maybe the timezone should be optional?

naoty commented 7 years ago

@allaire If you don't offer codes to regenerate this bug, I can't continue to debug.