tbbooher / journal

0 stars 0 forks source link

Need to get date value to autopopulate #17

Closed tbbooher closed 9 years ago

tbbooher commented 9 years ago

When I try to create a new entry, the date is not auto-populated.

screen shot 2015-07-03 at 6 39 02 am

in order to address this i try to use autovalue here

Schemas.Entry = new SimpleSchema(
  entry_date:
    type: Date
    autoform:
      type: "bootstrap-datepicker"
    label: 'Date'
    autoValue: ->
      if @isInsert
        return new Date
      else
        @unset()
      return
    optional: false
    index: -1
    unique: true

why doesn't this work?

tbbooher commented 9 years ago

this works:

Template.entry_form.onRendered ->
  dt = '7/3/2015'
  $("#entry_date").val(dt)

but, this is the worst way to do this . . . would like to use autoValue from collections2 or something clean

tbbooher commented 9 years ago

works well:

$("#entry_date").datepicker 'update', new Date