I have a scenario where the data being manipulated on the client is presented and interacted with in a different way than it is represented on the server.
Consider t
You have some options:
Override toJSON
to return the computed duration
Create a duration()
method on the Backbone Model
. Only downside that you have to call it differently (obj.duration()
instead of obj.get('duration')
). In your view that hands obj.toJSON()
to your template, mix in the duration
attribute
Use https://github.com/asciidisco/Backbone.Mutators (or similar) to create a derived getter for duration