malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.63k stars 770 forks source link

Zero formatting behavior isn't applying to Interval formatter #774

Open Alexandr-GlobeIn opened 3 years ago

Alexandr-GlobeIn commented 3 years ago

When you use toIntervalString / toClock methods - zero formatting behavior isn't working, because it isn't applying to func sharedFormatter() -> DateComponentsFormatter. Method don't do this:

public func apply(toFormatter formatter: DateComponentsFormatter) {
        formatter.allowsFractionalUnits = allowsFractionalUnits
    formatter.allowedUnits = allowedUnits
    formatter.collapsesLargestUnit = collapsesLargestUnit
    formatter.maximumUnitCount = maximumUnitCount
    formatter.unitsStyle = unitsStyle
    formatter.calendar = calendar
}