Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # test.html
- <template name="test">
- <p>Time test</p>
- {{#each times}}
- <p>Completion time: {{complete}}</p>
- <p>Time to complete: {{timeLeft}}</p>
- {{/each}}
- </template>
- # test.coffee
- @Test = new Meteor.Collection('test')
- if Meteor.isServer
- currentDate = new Date()
- finishDate = new Date(currentDate.getTime() + 360000)
- Test.insert { complete: finishDate }
- if Meteor.isClient
- Template.test.times = Test.find({},{
- transform: (doc) ->
- doc.timeLeft = (new Date(doc.complete.getTime()
- - new Date().getTime()))
- .getTime() / 1000 #number of seconds
- doc
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement