From fac71e64c9e230b61dda2d1942b82183ff1cc588 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 3 Dec 2015 12:56:22 -0800 Subject: [PATCH] Add created function to CocoModel --- app/models/CocoModel.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index b75491871..6d35f2dc8 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -22,6 +22,8 @@ class CocoModel extends Backbone.Model @saveBackup = _.debounce(@saveBackup, 500) @usesVersions = @schema()?.properties?.version? + created: -> new Date(parseInt(@id.substring(0, 8), 16) * 1000) + backupKey: -> if @usesVersions then @id else @id # + ':' + @attributes.__v # TODO: doesn't work because __v doesn't actually increment. #2061 # if fixed, RevertModal will also need the fix