Bug 65727 - timeShift function adds a year up when the added days land on a date between 26 and 31 of December
Summary: timeShift function adds a year up when the added days land on a date between ...
Status: RESOLVED INVALID
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.4.1
Hardware: PC All
: P2 normal (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-07 09:48 UTC by todord
Modified: 2021-12-09 10:25 UTC (History)
0 users



Attachments
Specific values where the bug is present (37.02 KB, image/png)
2021-12-07 09:48 UTC, todord
Details

Note You need to log in before you can comment on or make changes to this bug.
Description todord 2021-12-07 09:48:42 UTC
Created attachment 38122 [details]
Specific values where the bug is present

If you try to add days to the current day or specific date by using the timeShift function, and the generated date is between 26 December and 31 December, one year is also added.

For example, if the date is 2021-12-07 (YYYY-MM-dd) and I add 19 days (P19D) the date generated is 2022-12-26 instead of 2021-12-26.
Comment 1 Felix Schumacher 2021-12-07 15:47:09 UTC
Thanks for the report and the detailed instructions. I can reproduce the issue and will look into it.
Comment 2 Felix Schumacher 2021-12-07 17:03:52 UTC
OK, I digged a bit deeper and this is a combination of two things. First you didn't specify a locale and therefore a default one is used, which is most probably an English based one. The second factor is the usage of the big Y instead of the small y. The big Y means week-based-year. The result might be surprising (it was to me, too), but correct. I think you want to use yyyy-MM-dd.
Comment 3 todord 2021-12-09 10:25:50 UTC
(In reply to Felix Schumacher from comment #2)
> OK, I digged a bit deeper and this is a combination of two things. First you
> didn't specify a locale and therefore a default one is used, which is most
> probably an English based one. The second factor is the usage of the big Y
> instead of the small y. The big Y means week-based-year. The result might be
> surprising (it was to me, too), but correct. I think you want to use
> yyyy-MM-dd.

Thanks for the response, this was good to know, the small y fixed the problem for me.
Comment 4 The ASF infrastructure team 2022-09-24 20:38:22 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5598