View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0034928 | mantisbt | bugtracker | public | 2024-11-01 09:23 | 2025-02-26 18:52 |
Reporter | filipesantos | Assigned To | dregad | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 2.27.0 | ||||
Target Version | 2.28.0 | ||||
Summary | 0034928: Date conversion fails using a non-US date format in VersionUpdateCommand.php | ||||
Description | Hello everyone in the community. In my installation, I replaced the line $t_timestamp = strtotime( $t_timestamp ); by $t_timestamp = date_strtotime ( $t_timestamp ); and resolved it. | ||||
Steps To Reproduce | configure mantis to use non-US date format (DD/MM/YYYY HH:mm) | ||||
Tags | No tags attached. | ||||
Thanks for the report. I guess VersionUpdateCommand was forgotten in the fix for 0031836. I'll have a look. EDIT: actually VersionUpdateCommand was added in 0030415 (2.26.0), after 0031836 was fixed (2.25.6). |
|
Hello @filipesantos I have tried to reproduce the problem, but couldn't. As far as I can tell it is working as expected. Can you please confirm that you have configured $g_datetime_picker_format as appropriate to match $g_normal_date_format, as explained in the admin guide ? If not, please clarify the steps to reproduce, including your values for $g_datetime_picker_format and $g_normal_date_format, as well as the date(s) you entered and the actual error you got including stack trace (temporarily set |
|
Hello @dregad $g_short_date_format = 'd/m/Y'; With these settings representing the Brazilian date format, where first is the day, month and year; When creating a new version everything happens fine. I created a version at this moment, that is, its date is 03/11/2024 11:00, if I click on change the date is loaded correctly in Picker, but when saving it is inverted to 11/03/2024 11:00, in other words, he changed the day to the month. When analyzing the VersionUpdateCommand.php file, I noticed that when converting date to timestamp it still uses strtotime, which only accepts dates in the US standard. Sorry for my bad English. |
|
Thanks for the feedback, and don't worry about your English, it is perfectly fine. I was actually testing with my own local date format, which uses period As a workaround pending a fix in MantisBT code, you could use I believe your proposition to update VersionUpdateCommand is not appropriate, as it was decided not to allow custom date formats from REST API (see discussion in PR https://github.com/mantisbt/mantisbt/pull/1864#discussion_r1065202271, leading to removal of date_strtotime() from the related Commands in MantisBT master-2.25 f6c250af ) I think the change should go in manage_proj_ver_update.php, I'll analyze in more details later. |
|
@filipesantos it would be great if you could test the proposed fix and provide feedback, either here or on the GitHub pull request. |
|
Changing target version to 2.28.0 as the change is not so trivial anymore and could potentially introduce regressions. |
|