Feature #1885

Change Start from date to datetime

Added by Stacy Mader about 9 years ago. Updated about 3 years ago.

Status:ClosedStart date:2008-09-11
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Time tracking
Target version:-
Resolution:Duplicate

Description

For software bug tracking, it is sometimes good to know the time when the event occurred, so one can verify against log files. The default column descriptor for Start (start_date) is date, but it would be a nice feature to enable this to datetime.

If this is not possible, it would be good to hide Start on the issue form (c.f. issue 1296).

Cheers.

Redmine 0.7.3.1787 (MySQL)
Ruby 1.8.5
Rails 2.0.2


Related issues

Duplicates Redmine - Feature #5458: Extend Start/Due date to include time New 2010-05-06

History

#1 Updated by Stacy Mader about 9 years ago

Finishing of the last sentence :)

If this is not possible, it would be good to hide Start on the issue form (c.f. issue 1296) and define a new field. Unfortunately it does not look like datetime is avaiable for creating custom fields.

#2 Updated by Dmitry Shur about 9 years ago

Hi!
I've met the same problem yesterday.
Here's solution - alter table issues in DB (change type for start_date from date to datetime)
Then change some stuff in code.

find in {redmine_dir}/app/views/issues/show.rhtml: <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>

and change it to

{redmine_dir}/app/views/issues/show.rhtml: <_td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%=
format_datetime(@issue.start_date) %></td>_

In file {redmine_dir}/app/helpers/application_helper.rb add method
def format_datetime(date)
return nil unless date
date.strftime("%Y-%m-%d %H-%M-%S")
end

#3 Updated by Stacy Mader about 9 years ago

Many thanks! I updated the ISSUES table using the following:

mysql> alter table issues modify column field datetime;

Also, I made the changes you mention, however once I restart MySQL and Redmine, I still see only the date on the New issue form - the time is not present.

Cheers,
Stacy.

#4 Updated by Dmitry Shur about 9 years ago

Stacy, I'm not sure that you've altered table in the right way
I've did it next way - "alter table issues modify start_date datetime;"

Also, I've found out that I've misprinted at my previous note:
instead of _def format_datetime(date) should be def format_datetime(date)

I've faced some problem with updating issues after applying this changes. I haven't investigated yet, where is the problem, hope I'll have enough time in next couple of days. Anyway, I've made some more imporvements, hope that you won't face bug with updating

#5 Updated by Dmitry Shur about 9 years ago

I've fixed the problem I wrote above. Simply modify due_date column to be datetime =)

#6 Updated by Stacy Mader about 9 years ago

Thanks. Sadly I still only see the date in the Start field. I'm thinking it might be an issue with the javascript calender?

#7 Updated by Dmitry Shur about 9 years ago

Well, and did you try to add time at that field manually?
How it works at my instance - I'm adding new issues/updating existing - field start date is filled in only with current date. Then I'm adding time and save. After that I can see Start filled with date+time

#8 Updated by Riccardo Delpopolo almost 9 years ago

Is useful to have redmine automatically calculate the estimate time.

#9 Updated by rafael mascayano almost 8 years ago

Riccardo Delpopolo wrote:

Is useful to have redmine automatically calculate the estimate time.

I've installed version 0.8.4. I made the changes and success. The problem was when I tried to see gantt and calendar visualization. The first one , I replace:

    i_start_date = (i.start_date >= @gantt.date_from ? i.start_date : @gantt.date_from )
    i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to )

for

    i_end_date = (i.due_before <= @gantt.date_to ? i.due_before : @gantt.date_to )
    i_start_date = Date.parse(format_date(i_start_date))
    i_end_date = Date.parse(format_date(i_end_date))

Then I change

    i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor
    i_done_date = (i_done_date <= @gantt.date_from ? @gantt.date_from : i_done_date )
    i_done_date = (i_done_date >= @gantt.date_to ? @gantt.date_to : i_done_date )

for

    i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor
    i_done_date = (i_done_date <= @gantt.date_from ? @gantt.date_from : i_done_date )
    i_done_date = (i_done_date >= @gantt.date_to ? @gantt.date_to : i_done_date )
    i_done_date = Date.parse(format_date(i_done_date))

I still have problems with calendar, because it didn't display issues.

#10 Updated by Dipan Mehta over 4 years ago

Add related #11044.

#11 Updated by Toshi MARUYAMA about 3 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

I close as duplicate of #5458.
#5458 has more discussion.

#12 Updated by Toshi MARUYAMA about 3 years ago

  • Related to deleted (Feature #11044: Custom field types for time and datetime)

#13 Updated by Toshi MARUYAMA about 3 years ago

  • Duplicates Feature #5458: Extend Start/Due date to include time added

Also available in: Atom PDF