-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display informative message when date is in a wrong format #4017
Comments
The date you are using is in a wrong format. Will make some improvements to show a more informative error message. |
class TimeRange:
def __init__(self, start_date, end_date):
#self.start_date = datetime.strptime(events[0]['date_start'].replace(' ', '_')start_date, '%Y-%m-%d_%H:%M:%S')
self.start_date = datetime.strptime(start_date, '%Y-%m-%d_%H:%M:%S')
self.end_date = datetime.strptime(end_date, '%Y-%m-%d_%H:%M:%S')
print(self.start_date)
My format is correct. Here is the output of the variable self.start_date after converting it to the datetime type. Point out the mistake to me, otherwise I don't understand. |
However, if you put the following instruction in the body of the click function, it will be displayed correctly: def main(page: ft.Page):
def click(e):
page.open(ft.DatePicker(
current_date=time_range.start_date,
first_date=copy.copy(time_range.start_date),
last_date=time_range.end_date,
))
page.update() but If you use what is specified initially, it won't work. |
Duplicate Check
Describe the bug
I get a gray screen when I press the button
Code sample
Code
To reproduce
Click button
Expected behavior
Open TimeRange attribute self.start_date_picker
Screenshots / Videos
2024-09-19-21-18-01.mp4
Operating System
Linux
Operating system details
Debian 12
Flet version
0.24.1
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
The text was updated successfully, but these errors were encountered: