zjfjack / JZCalendarWeekView

Calendar Week & Day View in iOS Swift
MIT License
448 stars 120 forks source link

How can we change the date formatter #150

Open KavinduDissanayake opened 2 years ago

KavinduDissanayake commented 2 years ago

Screenshot 2022-06-13 at 18 57 26

parmar-mehul commented 4 months ago

Here you can how change dateFormatter, good luck!

class CustomJZRowHeader: JZRowHeader {
    public override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = .colorPrimary // uses correct color on Dark Mode

        self.lblTime.setTheme(textColor: .colorWhiteOnly, font: UIFont().SemiboldFont(ofSize: 9))

        self.dateFormatter.locale = Locale(identifier: AppUserDefault.shared.getValue(for: .DefaultLanguage))
    }
    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

    // Subclasses for Headers and Backgrounds
class CustomJZColumnHeader: JZColumnHeader {
    public override init(frame: CGRect) {
        super.init(frame: .zero)
        backgroundColor = .colorPrimary // the corresponding background-class will get the correct color

        self.dateFormatter.locale = Locale(identifier: AppUserDefault.shared.getValue(for: .DefaultLanguage))
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}