Andy
Andy

Reputation: 5

PYQT QDateTimeEdit and "dd.MM.yyyy" format

I am having a little problem with entering the date. The date should be entered in the format DD.MM.YYYY (e.g. 03.06.2021)

When I want to enter 31.05.2021 I have to jump to the month first, enter there 05 and then I can enter 31. June got 30 days and so I cannnot enter 31 initially. Any idea how to delay the date check until the field is left?

        self.f1 = QDateTimeEdit(QDate.currentDate())
        self.f1.setDisplayFormat("dd.MM.yyyy")
        self.f1.setFixedWidth(85)
        self.f1.setMinimumDate(QDate.fromString("01.01.2020", "dd.MM.yyyy"))
        self.f1.setMaximumDate(QDate(QDate.currentDate()))

Upvotes: 0

Views: 1132

Answers (0)

Related Questions