X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a132113f20073907fd2907a93c75c9d699516ee6..189a6efb18ccc8275be3c2ff7ce40f0330465142:/src/editor/modules/documentCanvas/commands.js?ds=sidebyside diff --git a/src/editor/modules/documentCanvas/commands.js b/src/editor/modules/documentCanvas/commands.js index 4c52c91..7302df3 100644 --- a/src/editor/modules/documentCanvas/commands.js +++ b/src/editor/modules/documentCanvas/commands.js @@ -1,7 +1,7 @@ define([ -'modules/documentCanvas/canvas/documentElement', -'./canvas/utils' -], function(documentElement, utils) { +'./canvas/utils', +'fnpjs/datetime' +], function(utils, datetime) { 'use strict'; @@ -109,14 +109,7 @@ commands.register('newNodeRequested', function(canvas, params, user) { var insertNode = function(insertion) { var doc = canvas.wlxmlDocument, - node, metadata, creator, currentDate, dt; - - var pad = function(number) { - if(number < 10) { - number = '0' + number; - } - return number; - }; + node, metadata, creator; doc.startTransaction(); node = insertion(); @@ -130,17 +123,9 @@ commands.register('newNodeRequested', function(canvas, params, user) { creator = 'anonymous'; } - currentDate = new Date(); - dt = pad(currentDate.getDate()) + '-' + - pad((currentDate.getMonth() + 1)) + '-' + - pad(currentDate.getFullYear()) + ' ' + - pad(currentDate.getHours()) + ':' + - pad(currentDate.getMinutes()) + ':' + - pad(currentDate.getSeconds()); - metadata = node.getMetadata(); metadata.add({key: 'creator', value: creator}); - metadata.add({key: 'date', value: dt}); + metadata.add({key: 'date', value: datetime.currentStrfmt()}); } doc.endTransaction(); return node;