6.0.0-git
2018-12-16

[#14749] SmartList due date parser doesn't always honor abbreviated date format preference
Summary SmartList due date parser doesn't always honor abbreviated date format preference
Queue Nag
Queue Version 4.2.1
Type Bug
State Feedback
Priority 2. Medium
Owners
Requester leonardo (at) cefetmg (dot) br
Created 2017-12-06 (375 days ago)
Due
Updated 2018-01-24 (326 days ago)
Assigned 2018-01-22 (328 days ago)
Resolved
Milestone
Patch No

History
2018-01-24 14:10:42 leonardo (at) cefetmg (dot) br Comment #3 Reply to this comment
Without looking at the code, but are you sure that the mini format 
is used here, and not the general date format preference?
I don't really know. I may even misunderstood your consideration, but 
I think that "due date" fields do validate dates using flexible rules, 
allowing users to use not only dates (in some format I can't say) but 
words like "today" and "tomorrow" too.

A little description is shown below the fields: "E.g., Is due within 2 
days of today"

Anyway, notice that even if the mini date format preference is not 
being used here, the behavior is not consistent, which may confuse 
users.

Regards,
Leonardo Lopes
2018-01-22 16:41:22 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Without looking at the code, but are you sure that the mini format is 
used here, and not the general date format preference?
2017-12-06 17:17:28 leonardo (at) cefetmg (dot) br Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ SmartList due date parser doesn't always honor abbreviated date format preference
Queue ⇒ Nag
Milestone ⇒
Patch ⇒ No
Reply to this comment
Hi everyone.

When creating a new SmartList in Nag, the due date is not parsed 
correctly or at least in a consistent way. My locale is 
"America/Sao_Paulo" and the abbreviated date format preference is 
"d-m-Y" ($_prefs['date_format_mini']['value'] = '%d/%m/%Y';)

The thing seems very messy: if the user set the due date as 
"01/12/17", the date is parsed as:
Horde_Date Object (
     [_year:protected] => 2017
     [_month:protected] => 1
     [_mday:protected] => 12
     [_hour:protected] => 12
     [_min:protected] => 0
     [_sec:protected] => 0
     [_timezone:protected] => America/Sao_Paulo
     [_defaultFormat:protected] => Y-m-d H:i:s
     [_formatCache:protected] => Array()
)
This isn't correct if you consider the "date_format_mini" preference.

Now, when trying to set the due date as "13/12/17", the date is parsed as:
Horde_Date Object
(
     [_year:protected] => 2017
     [_month:protected] => 12
     [_mday:protected] => 13
     [_hour:protected] => 12
     [_min:protected] => 0
     [_sec:protected] => 0
     [_timezone:protected] => America/Sao_Paulo
     [_defaultFormat:protected] => Y-m-d H:i:s
     [_formatCache:protected] => Array()
)

which is now correct according to the "date_format_mini" preference.

How can I explain to my users that if the day of month is smaller than 
12 they should set date as "Y-m-d", but if it is not they should use 
'Y-m-d'? Even to me it doesn't make any sense.

I will be glad to provide any additional information in order to solve this.

Thanks in advance.

Saved Queries