In the node display there are 4 Smart date formats. But none of them show the duration. It makes sense to show the duration. Also the custom formatter, does not support display of duration. Duration field is available as a field in views and there is no way to display it in the node as of now.
I also understand that the duration field in views is calculated on the fly and is not stored in database. I have seen the documentation and it says one of the main goals is to improve performance in using the date fields. This causes a minor performance lag, as all the durations has to be calculated again, every time the view is accessed. I think it is better to store the duration as field in the database, and recalculate only when the field is edited.
This has 2 advantages. It reduces the number of times duration is calculated and secondly, a duration field is available for use in nodes as well as views.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | smart_date-duration-display-3103587-5.patch | 4.18 KB | mandclu |
Comments
Comment #2
mandclu commentedActually the duration is stored, for the reasons you cited.
I'd be open to developing a way to show the duration in the node view. Would you want this in addition to the time range display, or instead of it? It seems like the simplest approach would be to allow the format to configure showing either the range or the start and duration. In the latter case the separator would be used between the start and the duration. It would also be simpler if we could always assume the start should come before the duration.
How much control would we need over the display of the duration? I could see a typical use case where you would want to collapse units to the largest applicable (e.g. 1h 30m or 7d 2h) but also some cases where you would want to force a particular unit (e.g. 90m).
Comment #3
mandclu commentedThe attached patch adds a new "duration" formatter, with a configurable separator. Let me know if this provides the output option you need.
Comment #4
mandclu commentedOops rolled an empty patch. Try this one instead.
Comment #5
mandclu commentedActually forgot to do a bit of code cleanup. Hopefully this patch is final.
Comment #7
mandclu commentedSince we're still in alpha (and I wanted to create a new release anyway) I decided to merge this in. Please reopen if you find additional issues.