View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
10811Bug reportsSurvey participants (Tokens)public2016-03-31 10:34
Reporterfrederikprijck Assigned ToLouisGac 
PrioritynoneSeverityminor 
Status closedResolutionwon't fix 
Summary10811: DateTime field displayed incorrect
Description

We have the following problem:

  • We use a custom attribute in the token entries to speciffy a date (a birthday in this case, but that's irrelevant).
  • This is used as default value for a question of the survey of type DateTime and another time as default value of a text field.
  • The date is visualized en stored incorrectly when using a DATETIME question, but my guess is the issue is due to the incorrect visualization / parsing of the date picker
  • The date is correctly visualized when using a TEXT field =>
Steps To Reproduce
  • Add a custom token field which will be refered to as ATTRIBUTE_1.
  • Add a token entry and set the value of attribute_1 to 1/01/1970. (http://prntscr.com/aii85b )
  • Activate the survey and make it closed access only.
  • Open the survey and use the token u recently created.

The result: http://prntscr.com/aii89y

Additional Information

I have uploaded a zip with both the LSA and LSS file.

TagsNo tags attached.
Attached Files
LS_DateTime_Tokens.zip (6,659 bytes)
Bug heat6
Complete LimeSurvey version number (& build)160123
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMSSQL
Server OS (if known)Windows 8.1
Webserver software & version (if known)IIS
PHP Version5.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2016-03-22 16:53

developer   ~36720

Better to use PHP date 1070-01-01 . Can you try ?

We can not really manage all date format (we have bug before when trying)

frederikprijck

frederikprijck

2016-03-22 17:00

reporter   ~36722

The format is listed as a format in the limesurvey settings => http://prntscr.com/aijgyn

If you don't support it, don't show it :-)

frederikprijck

frederikprijck

2016-03-22 17:06

reporter   ~36723

I've verified that it works when using yyyy-mm-dd . But it is a bug for dd/mm/yyyy

DenisChenu

DenisChenu

2016-03-22 17:13

developer   ~36725

It's the date shown to the user, not used internally : you really want we remove specific date format ?

See : https://manual.limesurvey.org/Question_type_-_Date#Minimum_date_.28date_min.29_.28New_in_2.05_.29 for example.

But if you don't like it : don't use it ....

frederikprijck

frederikprijck

2016-03-22 17:17

reporter   ~36727

So if I am correct, this is what you are saying:

  • I should always use yyyy-mm-dd in the token table?
  • The format for dates is only for visualisation? (doh, since internally a date should always use ISO 8601 spec (u call it php format, but it does have a name).

What exactly do you mean by "But if you don't like it : don't use it ...." ?

DenisChenu

DenisChenu

2016-03-22 17:24

developer   ~36730

We save the date in DB : in DB it's a datetime : 2015-01-01 00:00:00 : it's the real and only date.

We already try to allow "specific" date format in default or min . But it break with some language specific.
We already have bug with date compare , fixed now .

I say PHP date : because PHP always understand strtotime("now") or strtotime("2015-12-12").
ANd we use jsPHP for javascript.

You say : " If you don't support it, don't show it :-) " : my answer : you don't like it : don't use it ....

frederikprijck

frederikprijck

2016-03-22 17:46

reporter   ~36733

Last edited: 2016-03-22 17:47

As this issue is closed for the 2nd time without any valid reply here, I've decided to give a proper reply myself.

The dateformat used in the LS admin panel is only used for visualization for the end user. In the LS backend, we must always use the ISO 8601 specification (yyyy-mm-dd). (This is bad tho).

One could argue we should be able to use a different format in the Admin panel, and So do I think.
However, php uses the strtotime() function (http://php.net/manual/en/function.strtotime.php)

This strtotime function can not handle "dd/mm/yyyy" formats out of the box, so this is a php limitation. Not a LimeSurvey limitation.

However there are possible solutions in php for this issue, I'm not aware why this bug gets closed again and again without fixing it. it obviously is a bug, for which I have a workaround. But in the end, it still is a valid bug which should get fixed to get a better user experience.

As this ticket now has enough information for anyone who ever comes along and has the same issue, you can do whatever you want with it.

I have a valid workaround, so there is no problem for me to close this issue now.

But as one developer to another, don't close it but fix it. Date's are one of the most painful parts of programming.

PS: dont use strtotime() => http://www.hashbangcode.com/blog/how-i-learned-stop-using-strtotime-and-love-php-datetime

frederikprijck

frederikprijck

2016-03-22 17:52

reporter   ~36734

Last edited: 2016-03-22 17:55

Mec, Je pense que j'ai eu un problème avec te comprendre (votre anglais est vraiment mal dan ce ticket, mais pas de probleme pk mon francais et plus mal mdr), mais j'ai vu que vous êtes français, donc je comprende que c'est pas vraiment facile.

C'est pour ca que j'ai re-open le ticket plusieurs fois, pk pour moi c'etait pas clair.

Maintenaint c'est clair, mais pas resolu dans LS.
Je voudrais te remerci pour votre aide.

DenisChenu

DenisChenu

2016-03-22 18:23

developer   ~36736

It's not a bug, and we don't fix it : then close it.

We have information in manual, we have information in GUI (put your mouse over the label at minimum date).

frederikprijck

frederikprijck

2016-03-22 18:52

reporter   ~36737

Last edited: 2016-03-22 20:01

Where is this minimum date label, and how is it related ?
I am in the Edit Survey screen and there is nothing indicating this minimum date, not even in 2.5 (I'm using 2.06, but I've verified in the 2.5 version aswel): http://prntscr.com/ail1vc

I guess what you are refering to is the min date of the question date type, but there is a general "date format" setting for a survey (not a question). I expect this to be used for everything that's date related in the survey.

Apart from that the documentation does not mention anything about the format being for visualization only for the date question type: http://prntscr.com/ail34q .

Mazi

Mazi

2016-03-23 08:35

updater   ~36741

frederik, everything that needs to be said was well summed up by you at your post dated 2016-03-22 17:46.

Feel free to send us a pull request if you can come up with a nice fix that covers all the potential date formats.
Also, if you are missing information about this issue at the Limesurvey manual -> please add it. it is a wiki, everyone can and should extend it.

For now the development team decided to consider this one a "no fix" issue.

Issue History

Date Modified Username Field Change
2016-03-22 15:39 frederikprijck New Issue
2016-03-22 15:39 frederikprijck File Added: LS_DateTime_Tokens.zip
2016-03-22 16:53 DenisChenu Note Added: 36720
2016-03-22 17:00 frederikprijck Note Added: 36722
2016-03-22 17:06 frederikprijck Note Added: 36723
2016-03-22 17:13 DenisChenu Note Added: 36725
2016-03-22 17:13 DenisChenu Status new => closed
2016-03-22 17:13 DenisChenu Assigned To => DenisChenu
2016-03-22 17:13 DenisChenu Resolution open => no change required
2016-03-22 17:17 frederikprijck Note Added: 36727
2016-03-22 17:17 frederikprijck Status closed => feedback
2016-03-22 17:17 frederikprijck Resolution no change required => reopened
2016-03-22 17:24 DenisChenu Note Added: 36730
2016-03-22 17:24 DenisChenu Status feedback => closed
2016-03-22 17:24 DenisChenu Resolution reopened => no change required
2016-03-22 17:46 frederikprijck Note Added: 36733
2016-03-22 17:46 frederikprijck Status closed => feedback
2016-03-22 17:46 frederikprijck Resolution no change required => reopened
2016-03-22 17:47 frederikprijck Note Edited: 36733
2016-03-22 17:52 frederikprijck Note Added: 36734
2016-03-22 17:52 frederikprijck Status feedback => assigned
2016-03-22 17:52 frederikprijck Note Edited: 36734
2016-03-22 17:53 frederikprijck Note Edited: 36734
2016-03-22 17:53 frederikprijck Note Edited: 36734
2016-03-22 17:53 frederikprijck Note Edited: 36734
2016-03-22 17:54 frederikprijck Note Edited: 36734
2016-03-22 17:55 frederikprijck Note Edited: 36734
2016-03-22 18:23 DenisChenu Note Added: 36736
2016-03-22 18:23 DenisChenu Status assigned => closed
2016-03-22 18:23 DenisChenu Assigned To DenisChenu =>
2016-03-22 18:23 DenisChenu Resolution reopened => open
2016-03-22 18:24 DenisChenu Status closed => feedback
2016-03-22 18:24 DenisChenu Resolution open => reopened
2016-03-22 18:52 frederikprijck Note Added: 36737
2016-03-22 18:52 frederikprijck Status feedback => new
2016-03-22 18:52 frederikprijck Note Edited: 36737
2016-03-22 20:00 frederikprijck Note Edited: 36737
2016-03-22 20:01 frederikprijck Note Edited: 36737
2016-03-23 08:35 Mazi Note Added: 36741
2016-03-31 10:25 LouisGac Resolution reopened => won't fix
2016-03-31 10:34 LouisGac Status new => closed
2016-03-31 10:34 LouisGac Assigned To => LouisGac
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)