Browse code

Zobrazovanie datumu vzdy s dvoma ciframi

Cinan Rakosnik authored on 02/05/2013 at 15:09:58
Showing 1 changed files
... ...
@@ -20,7 +20,13 @@ class Xmpp.Views.Chat.MessageView extends Backbone.View
20 20
     if (nowDate.getDate() != @dateSent.getDate() &&
21 21
         nowDate.getMonth() != @dateSent.getMonth() &&
22 22
         nowDate.getFullYear() != @dateSent.getFullYear())
23
-      return @dateSent.getFullYear() + '/' + (@dateSent.getMonth()+1) + '/' + @dateSent.getDate() +
24
-        ' @ ' + @dateSent.getHours() + ':' + @dateSent.getMinutes()
23
+      return @dateSent.getFullYear() + '/' + @_padDate((@dateSent.getMonth()+1)) + '/' + @_padDate(@dateSent.getDate()) +
24
+        ' @ ' + @_padDate(@dateSent.getHours()) + ':' + @_padDate(@dateSent.getMinutes())
25 25
 
26
-    return @dateSent.getHours() + ':' + @dateSent.getMinutes()
27 26
\ No newline at end of file
27
+    return @_padDate(@dateSent.getHours()) + ':' + @_padDate(@dateSent.getMinutes())
28
+
29
+  _padDate: (number) ->
30
+    if number < 10
31
+      '0' + number
32
+    else
33
+      number
28 34
\ No newline at end of file