DateFormatter.date(from:) doesn't work in TimelineProvider.getTimeline(in:completion:)

It seems DateFormatter.date(from:) can't parse any date string in TimelineProvider.getTimeline(in:completion:) while DateFormatter.string(from:) works.

Code Block language
        let formatter = DateFormatter()
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.dateFormat = "yyyyMMdd"
        let date = formatter.date(from: "20201006")
        let string = formatter.string(from: Date())


Result:
Code Block
date = (Date?) nil
string = (String) "20201006"


Is it a bug or am I doing wrong?
Answered by mihara.ryosuke in 639110022
Resolved myself. The debugger indicates date == nil, however, LLDB command "po" prints out a Date object. Nothing is wrong with DateFormmater.
Accepted Answer
Resolved myself. The debugger indicates date == nil, however, LLDB command "po" prints out a Date object. Nothing is wrong with DateFormmater.
DateFormatter.date(from:) doesn't work in TimelineProvider.getTimeline(in:completion:)
 
 
Q