Default value for custom field of date type

Get help from other users here.

Moderators: Developer, Contributor

deboutv
Posts: 507
Joined: Jan 15, 2007 9:31 am
Location: La Ciotat, FRANCE
Contact:

Re: Default value for custom field of date type

Post by deboutv » Mar 26, 2008 4:42 am

It don't have MSSQL server, so it is difficult to find the issue :(
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/

Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

dyawlak
Posts: 66
Joined: Dec 07, 2007 11:42 am

Re: Default value for custom field of date type

Post by dyawlak » Mar 26, 2008 5:02 am

are you able to give me any pointers - i'm not too up on PHP but have programmed in other languages.

Thanks

deboutv
Posts: 507
Joined: Jan 15, 2007 9:31 am
Location: La Ciotat, FRANCE
Contact:

Re: Default value for custom field of date type

Post by deboutv » Mar 26, 2008 5:24 am

The issue is not PHP but SQL syntax.
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/

Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux

dyawlak
Posts: 66
Joined: Dec 07, 2007 11:42 am

Re: Default value for custom field of date type

Post by dyawlak » Mar 26, 2008 8:09 am

do you know which of the scripts its in and I'll have a look?


Thanks

vboctor
Site Admin
Posts: 1286
Joined: Feb 13, 2005 5:11 pm
Location: Redmond, Washington
Contact:

Re: Default value for custom field of date type

Post by vboctor » Mar 27, 2008 12:31 am

In Mantis 1.2, it will be possible to set the default value for a custom date field to values like: {tomorrow}, {yesterday}, {+ 3 days}, {-2 days}, {next week}.
Migrate your MantisBT to the MantisHub Cloud

Guil
Posts: 8
Joined: Aug 29, 2011 5:33 am
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil » Aug 29, 2011 5:36 am

Hello,

I tried on mantis 1.2.5 do add default value to date custom field like {+5 days} or {tomorrow} byt my default custom field remain empty...

A bug ? a wrong configuration ?

Regards

atrol
Site Admin
Posts: 7681
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Default value for custom field of date type

Post by atrol » Aug 29, 2011 6:25 am

Did you enable "Display When Reporting Issues" ?
Please use Search before posting and read the Manual

Guil
Posts: 8
Joined: Aug 29, 2011 5:33 am
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil » Aug 29, 2011 8:19 am

Hello

Sorry I didn't explained well.
My custom field is showned on my report.. I can fill it and set a date using the boxes. (this is working fine)

The problem is that I want to set a default value :
I supposed that the date boxes of the custom field should be set to today+1day when I set {tomorrow} on default value of the custom field properties.
But it remained not set to today + 1day.. the boxes are unset and I need to select them.. (no date is set)

hope to be clear :-( (I made a screenshot copy)
Attachments
date_mantis_config.png
date_mantis_config.png (6.93 KiB) Viewed 7298 times
date_mantis.png
date_mantis.png (1.45 KiB) Viewed 7298 times

atrol
Site Admin
Posts: 7681
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Default value for custom field of date type

Post by atrol » Aug 29, 2011 9:43 am

I understood your issue, but I was not able to reproduce it. ({tried tomorrow} and {+5 days}
I tried with IE8 and FF6.

Are you able to reproduce the issue with Mantis2Go ?
Please use Search before posting and read the Manual

Guil
Posts: 8
Joined: Aug 29, 2011 5:33 am
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil » Aug 29, 2011 11:06 am

I dind't tried with mantis2go but a real install on my server...
I don't think this is a navigator problem but more surely à php date() function

On this page : http://docs.mantisbt.org/master-1.2.x/e ... STOMFIELDS

we can read :
Custom fields of type date can be defaulted to a specific dates or to relative dates. Typically relative dates is the scenario that makes sense in most of the cases. The format for specific dates is an integer which indicates the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT), which is the format consumed by the PHP date() method. The relative scenario expects default values like {tomorrow}, {yesterday}, {+2 days}, {-3 days}, {next week}, etc. The curly brackets indicate that this is a logical value which is then evaluated using the PHP strtotime() function.
So it sound that it could be a strtotime() function, but I don't know how to test or debug..

atrol
Site Admin
Posts: 7681
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Default value for custom field of date type

Post by atrol » Aug 29, 2011 11:27 am

Create a file tstrotime.php and run it in your browser

Code: Select all

<?php
echo strtotime( '+5 days');
?>
The result should be someting like: 1315067165
Please use Search before posting and read the Manual

Guil
Posts: 8
Joined: Aug 29, 2011 5:33 am
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil » Aug 29, 2011 3:46 pm

I'm not at the office now but i made this test and it worked... strtotime is ok...
It is like my {+5 days} is not interprated ... is there a ddebug mode under mantis ?? :D

atrol
Site Admin
Posts: 7681
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Default value for custom field of date type

Post by atrol » Aug 30, 2011 2:03 am

Again: Are you able to reproduce the issue with Mantis2Go ?
Please use Search before posting and read the Manual

Guil
Posts: 8
Joined: Aug 29, 2011 5:33 am
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil » Oct 06, 2011 9:38 am

Hello

I found what I thought to be an issue.
In fact the field is well filled in when we create it.
But if the field already exist, changing the parameters don't impact it..

after mind, this is not abnormal...

So no issue. this is working fine. Sorry fr bandwidth.

Post Reply