You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Short version of the problem is that I never got the code to pass unit tests until I modified the code as follows (see comments about timezone):
function getTimeAgoDescription(dateString) {
const startDate = new Date(dateString + 'T00:00:00'); // Add time to avoid timezone issues
const currentDate = new Date();
...
}
Ironically, I reverted to good old Stackoverflow for the answer.
I say ironic because at no time and regardless of the amount of context or passing code into Cody Chat did it ever suggest the issue was js Date() defaults to UTC when passed a date string without a time/timezone. All the tests were failing (off by one day).
I would think this is exactly the kind of code assistance (pair programming) Cody is ideally suited for:
Cody: "Hey buddy, your intention is probably to get a date in your local timezone and if you pass only a date string, you'll get UTC instead. Me: Thanks Cody, appreciate you got my back.
The text was updated successfully, but these errors were encountered:
The sample code below is provided on Quick Start
Short version of the problem is that I never got the code to pass unit tests until I modified the code as follows (see comments about timezone):
Ironically, I reverted to good old Stackoverflow for the answer.
I say ironic because at no time and regardless of the amount of context or passing code into Cody Chat did it ever suggest the issue was js Date() defaults to UTC when passed a date string without a time/timezone. All the tests were failing (off by one day).
I would think this is exactly the kind of code assistance (pair programming) Cody is ideally suited for:
The text was updated successfully, but these errors were encountered: