mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-29 10:40:04 +00:00
Lots of stuff
This commit is contained in:
19
client/app/js/models/replays/replay.coffee
Normal file
19
client/app/js/models/replays/replay.coffee
Normal file
@@ -0,0 +1,19 @@
|
||||
class @Replay extends Backbone.Model
|
||||
urlRoot: '/replays'
|
||||
|
||||
getFormat: ->
|
||||
window.Formats[@get('format')].humanName
|
||||
|
||||
getCreatedAt: ->
|
||||
date = new Date(@get('created_at'))
|
||||
day = date.getDate()
|
||||
month = date.getMonth() + 1
|
||||
year = date.getFullYear()
|
||||
timeOfDay = 'a.m.'
|
||||
hours = date.getHours()
|
||||
minutes = "00#{date.getMinutes()}"[-2...]
|
||||
seconds = "00#{date.getSeconds()}"[-2...]
|
||||
if hours > 12
|
||||
hours = hours % 12
|
||||
timeOfDay = 'p.m.'
|
||||
"#{year}/#{month}/#{day} #{hours}:#{minutes}:#{seconds} #{timeOfDay}"
|
||||
Reference in New Issue
Block a user