1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-09-02 17:07:19 +00:00
2016-02-01 23:19:30 +01:00

20 lines
553 B
CoffeeScript

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}"