[ 
https://issues.apache.org/jira/browse/OFBIZ-3125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773124#action_12773124
 ] 

Adrian Crum commented on OFBIZ-3125:
------------------------------------

I understand your focus is on production. I'm trying to make the point that 
production is not the only place where durations would be used - so let's try 
to look at the bigger picture so that we can come up with the best design.

I spent some time over the weekend looking into this further. Now I'm convinced 
even more that we need a duration data type. Right now different entities are 
using different data types for durations - so there is no consistency.

I would recommend entering durations as yyyy:mm:dd:hh:mm:ss:mm. I'm working on 
improving the TimeDuration class - it will be able to parse a string in that 
format. It parses right-to-left so you only need to enter the least significant 
portions. It will also decode the various numeric representations currently in 
use.

As I mentioned before, if we modify the framework to support durations, then 
there will be less work handling/representing them.

I should have some improvements committed in the next few days.


> Add a duration field type to improve input and representation of durations: 
> DurationField, allows to show and input *d *h *m *s *ms
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-3125
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3125
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Karim Rahimpur
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Is there interest in having a field that can parse and display durations 
> expressed like these?
> - 10d 5h 6m
> - 6m 45s
> - 1s 145ms
> If so, then I can provide that. We're using this to handle durations as 
> humans are used to, instead of having to see and express them in 
> milliseconds. E.g. durations used in production runs: an operator knows it 
> took so many hours to complete a task but it's uncomfortable to have to 
> convert that to milliseconds when you want to store that data.
> So if there is enough interest I could provide a patch that adds a 
> DurationField which can be used in forms like shown in these examples:
> - A field that displays a duration in the *d *h *m *s *ms format - this is a 
> substitute for <display/> in milliseconds:
> {code:xml}
> <field name="estimatedSetupMillis" 
> title="${uiLabelMap.ManufacturingTaskEstimatedSetupMillis}">
>     <duration disabled="true"/>
> </field>
> {code}
> - A field that allows to input a duration in the *d *h *m *s *ms format - 
> this is a substitute for <text/> input in milliseconds:
> {code:xml}
> <field name="actualSetupMillis" 
> title="${uiLabelMap.ManufacturingTaskActualSetupMillis}">
>     <duration/>
> </field>
> {code}
> Comments are welcome.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to