Computed Date Formats Test

< Back   View Blog   View Source  
This is a simple test of using alexanderbeletsky/backbone-computedfields with MomentJS to generate several different formats of a date field in a Backbone model. This page uses RequireJS to load all the script to avoid any reference to the global moment function. The goal is to perform all the formatting in the model and make these fields available to the view's template when rendering without including them in the JSON payload to the server.

Rendered

toJSON()

toJSON({ computedFields: true })