blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Stuart Preston's Blog

Mostly about Visual Studio Team System, Team Foundation Server, Engineering Practices and Application Lifecycle Management.

WorkItem Date Picker control - not necessary?

Paul Hacker wrote about a WorkItem date picker control for TFS:

I have just made available a workitem control that will allow you pick a Date from a calendar rather than having to enter in a date freeform into workitems. I went as far as to create an msi for easier deployment (not that it’s really hard) . I have also included a read me and a sample workitem that you can use as a reference. Please let me know what you think, I find it useful and hope you will to.

http://phacker.wordpress.com/2007/07/28/workitem-date-picker-control/

I haven't downloaded and tried it yet, but I wonder if he has overlooked one of the built in TFS controls - DateTimeControl.  On a form in a WIT, you can specify a <Control Type="DateTimeControl"... rather than <Control Type="FieldControl"... 

E.g.

<Column PercentWidth="50">
      <Group Label="Status">
       <Column PercentWidth="33">
        <Control Type="DateTimeControl" FieldName="MyClient.StartDate" Label="Start Date" LabelPosition="Left"/>
        <Control Type="DateTimeControl" FieldName="MyClient.EndDate" Label="End Date" LabelPosition="Left"/>
        <Control Type="FieldControl" FieldName="System.State" Label="Current Status" LabelPosition="Left"/>
       </Column>
      </Group>
</Column>

In addition, there's an undocumented "Format" and "CustomFormat" attribute you can use to style the control.  See http://blogs.msdn.com/narend/archive/2007/02/09/hidden-attributes-to-control-your-work-item-form-layout.aspx

One limitation I have found is that when you use the DateTime control, the current time is stored, no matter what date you pick.  This seems to be a limitation of the underlying Field storage mechanism. This is a limitation of the .NET DateTime control which behaves in a similar way to how it does when used in a Winform application (i.e. passing the current time when you don't explicitly set it).

[Edit] The underlying field storage mechanism does indeed support full precision date times.

Published 31 July 2007 09:04 by Stuart.Preston

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ben Pryor said:

Actually, the underlying storage for DateTime fields is a datetime column in SQL server, so storing full precision date/time values is possible. The middle tier accepts any time value - I remember when we were writing Teamprise's WIT support I looked into this and decided to do what Visual Studio does, which is pass the current time. There's also some support in the query mechanism to convert clauses into date span clauses automatically, e.g. MyDateField = 1/10/07 becomes MyDateField >= 1/09/07 00:00:00 AND MyDateField < 1/10/07 00:00:00. My recollection of the details are a little fuzzy (it's been a while since I looked at all this) but that's the gist of it. The net result is that in many cases, the time portion of the date time value doesn't matter.
July 31, 2007 19:00
 

Stuart.Preston said:

I agree - and yes I was aware of the underlying storage.  What I'd really like is a way for the WIT model to support expressions such as "@Today" (which is 00:00:00 on the current day) inside a default validation rule - or even concatenation (e.g. adding 23:59:59 onto the current day).

My reasons for this are that in Scrum for Team System, because of the limitations of Iteration Path and not being able to store metadata against it, we defined our own work item type (Sprint) - which has Sprint Start and Sprint End dates. 

The precision really does matter, as all our reports work off history in a certain time range - so storing the current time of when that work item was created isn't ideal and we have to change the behaviour of the reports to make them more tolerant.

July 31, 2007 19:07
 

Stuart.Preston said:

Manual trackback.

August 5, 2007 22:26
 

Team System News said:

Buck Hodges on Team System Web Access (formerly TeamPlain) power tools release is now available. Rob...

August 7, 2007 15:52

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems