bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Date/Time Custom Fields

RESOLVED FIXED in Bugzilla 3.2

Status

()

Bugzilla
Bugzilla-General
P1
enhancement
RESOLVED FIXED
12 years ago
10 years ago

People

(Reporter: Max Kanat-Alexander, Assigned: Max Kanat-Alexander)

Tracking

(Blocks: 2 bugs)

2.23.3
Bugzilla 3.2
Dependency tree / graph
Bug Flags:
approval +

Details

Attachments

(1 attachment)

(Assignee)

Description

12 years ago
Some users want to have a field that stores a date and a time. It would be different than just a normal plain-text field because it would be stored as a datetime in the database (so that it sorts correctly) and it would be validated upon entry (to make sure that you couldn't enter an invalid date).

Everything except the validation is pretty simple.

It probably also ought to be formatted in some nice way, possibly by letting users choose a format. (We could add a "format" column to fielddefs, which could also be used as a regular expression for FIELD_TYPE_FREETEXT to validate the input.) I think that should be done in a separate bug, though. For now we should just require people to input the dates in the format that makes sense to their database.

Comment 1

12 years ago
The validation is pretty trivial, see Util::validate_date() and Util::format_time() to redisplay the date in the format you want.
and if the user has javascript available, a little calendar popup to pick a date off of and fill it in for you would be cool, too. :)
(Assignee)

Comment 3

11 years ago
(In reply to comment #2)
> and if the user has javascript available, a little calendar popup to pick a
> date off of and fill it in for you would be cool, too. :)

  Yep, that's exactly the plan. We can use YUI for it.
(Assignee)

Comment 4

11 years ago
Okay, so YUI doesn't have a time widget, only a date widget. So either we use a different library than YUI or we find an extension. I don't want to write our own time widget, that would be ridiculous.

Also, I'm not going to split every date field into two fields, one for date and the other for time, because that would complicate the code needlessly.
(Assignee)

Updated

11 years ago
Blocks: 397098
(Assignee)

Updated

11 years ago
Blocks: 397099
(Assignee)

Updated

11 years ago
Blocks: 397102
(Assignee)

Updated

11 years ago
Priority: -- → P1
Target Milestone: --- → Bugzilla 3.2
(Assignee)

Comment 5

11 years ago
Created attachment 285456 [details] [diff] [review]
v1

  Okay, here it is. A very basic implementation.

  I have to say, Bugzilla's architecture is finally so nice that adding this field was an experience that went exactly like it should have. :-)
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #285456 - Flags: review?(LpSolit)

Comment 6

11 years ago
Comment on attachment 285456 [details] [diff] [review]
v1

>Index: template/en/default/bug/field.html.tmpl

>+    [% CASE constants.FIELD_TYPE_DATETIME %]
>+      <input name="[% field.name FILTER html %]" size="20"
>+             value="[% value FILTER html %]">

Nit: I would love to see "(YYYY-MM-DD HH:mm:ss)" being displayed besides the date fields, so that the user has a chance to know which format to use. Else you have to wait to get both date and time errors to discover them.

r=LpSolit with or without my nit fixed.
Attachment #285456 - Flags: review?(LpSolit) → review+

Updated

11 years ago
Flags: approval+
(Assignee)

Comment 7

11 years ago
I figure we can deal with formatting comments in bug 397102.
(Assignee)

Comment 8

11 years ago
Checking in Bugzilla/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v  <--  Bug.pm
new revision: 1.212; previous revision: 1.211
done
Checking in Bugzilla/Constants.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Constants.pm,v  <--  Constants.pm
new revision: 1.84; previous revision: 1.83
done
Checking in Bugzilla/Field.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Field.pm,v  <--  Field.pm
new revision: 1.29; previous revision: 1.28
done
Checking in Bugzilla/Util.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Util.pm,v  <--  Util.pm
new revision: 1.62; previous revision: 1.61
done
Checking in template/en/default/bug/field.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl,v  <--  field.html.tmpl
new revision: 1.12; previous revision: 1.11
done
Checking in template/en/default/global/field-descs.none.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/global/field-descs.none.tmpl,v  <--  field-descs.none.tmpl
new revision: 1.25; previous revision: 1.24
done
Checking in template/en/default/global/user-error.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/global/user-error.html.tmpl,v  <--  user-error.html.tmpl
new revision: 1.235; previous revision: 1.234
done
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED

Updated

11 years ago
Keywords: relnote
(Assignee)

Comment 9

10 years ago
Added to the release notes for Bugzilla 3.2 in a patch on bug 432331.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.