View Issue Details

IDProjectCategoryView StatusLast Update
0023578mantisbtdocumentationpublic2017-11-14 16:04
ReporternaibAssigned Todregad 
PrioritynormalSeveritytextReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.7.1 
Target Version2.9.0Fixed in Version2.9.0 
Summary0023578: Document need for consistency between "normal" and "datepicker" date formats
Description

Original issue summary: Odd display in project version date after upgrading from 1.1.2 -> 1.3.12 -> 2.7.1

In my installation, after following the upgrade path noted above, if I attempt to edit the Date Order value, I notice that it is formatted in an odd way, and looking at the HTML, the date picker seems to be using the value attribute as a literal value for the data-picker-format to format.

<input id="proj-version-date-order" name="date_order" class="datetimepicker input-sm" data-picker-locale="en-us" data-picker-format="Y-MM-DD HH:mm" size="16" value="14 12 2017 09:30" style="" type="text">

My configuration contains the following:

$g_short_date_format      = "d/m/Y";
$g_normal_date_format     = "d m Y H:i";
$g_complete_date_format   = "d m Y H:i T";
#$g_datetime_picker_format = "D MMM Y H:mm";

$g_datetime_picker_format is commented out because it causes further problems.

TagsNo tags attached.

Relationships

related to 0023606 new editing an existing version corrupts date field 
related to 0022827 new Wrong dates in "Edit Project Version" 

Activities

naib

naib

2017-11-02 03:51

reporter  

Screenshot-2017-11-2b.png (12,389 bytes)
Screenshot-2017-11-2b.png (12,389 bytes)
naib

naib

2017-11-02 03:53

reporter   ~0058112

Datetime picker screenshot.



dregad

dregad

2017-11-02 05:26

developer   ~0058114

I believe this is due to the inconsistency between the MantisBT date format (d m Y H:i in your case) and the date picker's (defaulting to Y-MM-DD HH:mm since you commented out $g_datetime_picker_format).

Given the date 14.12.2017 in your screenshots as an example, the day becomes the year (14), and the year (2017) is truncated to 2 chars and becomes the day (20).

I suggest you try setting $g_datetime_picker_format as appropriate to match your normal date format (at least in the order of the date's elements, d/m/y).

Finally, with regards to `$g_datetime_picker_format = "D MMM Y H:mm"; causing further problems , I just tried this locally and it seems to work just fine AFAICT so I'm not sure what your problem is.

naib

naib

2017-11-02 22:56

reporter   ~0058118

Changing my configuration to:

$g_normal_date_format     = "d M Y H:i";
$g_complete_date_format   = "d M Y H:i T";
$g_datetime_picker_format = "D MMM Y H:mm";

results in the expected date and datetime picker display. Is it a requirement of Mantis that $g_datetime_picker_format align with $g_normal_date_format?

The following configuration causes Mantis to misinterpret the values in the Date Order field:

$g_normal_date_format     = "d m Y H:i";
$g_datetime_picker_format = "D MMM Y H:mm";

the normal format is configured with a numeric month with leading zeros, while the picker format's month is e.g. "Jan".

dregad

dregad

2017-11-03 08:16

developer   ~0058125

Is it a requirement of Mantis that $g_datetime_picker_format align with $g_normal_date_format?

I never thought about it until today, but I guess it should be, reason being that the date value has to be passed on from Mantis (PHP) to the date picker (Javascript) - and back - via the input field's contents so the format should be consistent.

In any case, I fail to understand why you would want to use different formats to display dates. Doesn't make sense to me.

dregad

dregad

2017-11-03 10:15

developer   ~0058126

I updated the Admin Guide to reflect the need for $g_normal_date_format and $g_datetime_picker_format to be consistent.

naib

naib

2017-11-06 00:18

reporter   ~0058142

Just for reference, I want to use the following two formats, the shorter one for where space is a priority, the longer one for where I want clarity first:

  • 10 Nov 2017 11:07
  • 10 11 2017 11:07
dregad

dregad

2017-11-06 06:31

developer   ~0058145

I want to use the following two formats, the shorter one for where space is a priority, the longer one for where I want clarity first:

The places where the different date formats are used can only be changed in the source code, but you still need to maintain the consistency between $g_datetime_picker_format align and $g_normal_date_format.

With regards to "where space is a priority", this is why we have short_date_format. Check the docs for more info on where each format is used, or look at the source.

Related Changesets

MantisBT: master eae6f667

2017-11-03 10:09:42

dregad

Details Diff
Document need for consistency in date formats

$g_datetime_picker_format and $g_normal_date_format settings need to be
consistent.

Differences between them may result in unexpected behavior such as an
invalid interpretation of the date by the DateTime picker widget, or
errors trying to save a modified date.

Fixes 0023578
mod - config_defaults_inc.php Diff File
mod - docbook/Admin_Guide/en-US/config/date.xml Diff File

Issue History

Date Modified Username Field Change
2017-11-02 03:51 naib New Issue
2017-11-02 03:51 naib File Added: Screenshot-2017-11-2a.png
2017-11-02 03:51 naib File Added: Screenshot-2017-11-2b.png
2017-11-02 03:53 naib File Added: 2017-11-02 15_38_56-MantisBT.png
2017-11-02 03:53 naib Note Added: 0058112
2017-11-02 05:26 dregad Status new => feedback
2017-11-02 05:26 dregad Note Added: 0058114
2017-11-02 22:56 naib Note Added: 0058118
2017-11-02 22:56 naib Status feedback => new
2017-11-03 08:16 dregad Note Added: 0058125
2017-11-03 10:13 dregad Changeset attached => MantisBT master eae6f667
2017-11-03 10:13 dregad Assigned To => dregad
2017-11-03 10:13 dregad Status new => resolved
2017-11-03 10:13 dregad Resolution open => fixed
2017-11-03 10:13 dregad Fixed in Version => 2.9.0
2017-11-03 10:15 dregad Severity minor => text
2017-11-03 10:15 dregad Category ui => documentation
2017-11-03 10:15 dregad Target Version => 2.9.0
2017-11-03 10:15 dregad Note Added: 0058126
2017-11-06 00:18 naib Note Added: 0058142
2017-11-06 06:31 dregad Summary Odd display in project version date after upgrading from 1.1.2 -> 1.3.12 -> 2.7.1 => Document need for consistency between "normal" and "datepicker" date formats
2017-11-06 06:31 dregad Description Updated View Revisions
2017-11-06 06:31 dregad Note Added: 0058145
2017-11-14 16:03 atrol Relationship added related to 0023606
2017-11-14 16:04 atrol Relationship added related to 0022827