Closed zabkov closed 7 years ago
I think that one of the purposes of the app is to expose the student to the datetime module. When I did the app I encounter something similar. But part of the learning process is to go to the documentation and figure out what other options the datetime module has. Turns out that the module has a date method. So you can say instead...
current_date = date.today()
dt = user_birth_date - current_date
return dt.days
The date.today()
will give you year, month, and day without hours, minutes, seconds. With that you will have no problem calculating yesterday or tomorrow delta times.
Hi @diazgilberto thanks so much for posting this. Yes, I totally spaced on today() vs now() during the recording. I'm going to go back and update the video. It's one of those things of speaking, presenting, and coding all at the same time and just letting that detail slip by...
And, thanks @zabkov for posting the original issue!
@mikeckennedy You did great. It is one of those things where makes the student go out and research on their own. Also, the lecture taught me how to refactor my code to get the outcome I want. The student can see the process of development; code, test, refactor and repeat.
Hi guys. Got a chance to re-record the videos and fixed this. Thanks for reporting it.
👍
It is incorrect to use int() for calculating days from seconds, there should be math.ceil() Now is 3/30/2017, input is 3/31/2017, and the app says that today is the birthday