Skip to content

Commit

Permalink
Re-implement CURRENT_DATETIME replacement in metadata
Browse files Browse the repository at this point in the history
Closes prose#277
  • Loading branch information
holic committed May 13, 2015
1 parent 6f82795 commit 353efbf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/collections/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,17 @@ module.exports = Backbone.Collection.extend({
});
});
}

if (value && value.field && value.field.value === "CURRENT_DATETIME") {
value.field.value = (new Date()).format('Y-m-d H:i:s O');
}
});
} else if (_.isString(raw)) {
try {
defaults = jsyaml.safeLoad(raw);

if (defaults.date === "CURRENT_DATETIME") {
var current = (new Date()).format('Y-m-d H:i');
var current = (new Date()).format('Y-m-d H:i:s O');
defaults.date = current;
raw = raw.replace("CURRENT_DATETIME", current);
}
Expand Down

0 comments on commit 353efbf

Please sign in to comment.