As soon as the 4 number year is input the output will be generated.
For example, if you input the date of October 1, 2019, you will get the results of:
45 days: Thursday, November 14, 2019
180 days: Sunday, March 29, 2020
But, if you input the date of December 1, 2019, you will get the results of:
45 days: Wednesday, January 15, 2020
180 days: Friday, May 29, 2020
This can not be correct because there are 31 days in December. 31 + 15 = 46? Some sort of miscalculation happens in most months.
The reason you're getting November 14 in the first case is because daylight savings time changes sometime in October. Your afterTime() function treats all days as 24 hours long, but when DST ends we add an extra hour to that day. So you're going from Oct 1 00:00:00 to Nov 14 23:00:00 instead of Nov 15 00:00:00.
Use the built-in date arithmetic in the Date class, it automatically adjusts for this.
This pen here pulls the correct date but it is from the current date and not the actual input dates
[login to view URL]
Can you fix? I will only consider people who start their quote with the word "BLUE".
38 freelancers are bidding on average $137 for this job
hi i have 4 years experience in like thins kind of job, hi i have 4 years experience in like thins kind of job, hi i have 4 years experience in like thins kind of job
Blue Hi Do leaps years need to be considered as well? It can get messy - I would probably use some sort of library for this. Please let me know if interested.