powmedia / backbone-forms

Form framework for BackboneJS with nested forms, editable lists and validation
MIT License
2.17k stars 413 forks source link

timezone for date editor #335

Open zzart opened 10 years ago

zzart commented 10 years ago

Hi, Current date editor always sets hours and minutes to 00:00 , this is a bit confusing since in some cases changes the day date itself. To fix this a little improvement to getValue method :


  /**
   * @return {Date}   Selected date
   */
  getValue: function() {
    var year = this.$year.val(),
        month = this.$month.val(),
        date = this.$date.val();

    if (!year || !month || !date) return null;

    current = new Date()
    return new Date(Date.UTC(year, month, date, current.getHours(), current.getMinutes()));
  },     

Ta