Esempio n. 1
0
  constructor(props) {
    super(props);

    this.timezones = moment.tz.names();
    this.timezones.unshift(moment.tz.guess());

    this.jQueryId = `#${props.id}`;

    this.timezoneOptions = this.timezoneOptions.bind(this);
    this.onChange = this.onChange.bind(this);
  }
  constructor(props) {
    super(props)

    this.state = {
      date: moment(),
      time: moment(),
      timezone: moment.tz.guess(),
      dateTime: moment()
    }

    if (!('dateLabel' in props)){
      this.dateLabel = 'Date';
    } else {
      this.dateLabel = props.dateLabel;
    }

    if (!('timeLabel' in props)){
      this.timeLabel = 'Time';
    } else {
      this.timeLabel = props.timeLabel;
    }

    this.dateId = `${this.props.id}_date`;
    this.timeId = `${this.props.id}_time`;
    this.timezoneId = `${this.props.id}_timezone`;
    this.jQueryDateId = `#${this.dateId}`;
    this.jQueryTimeId = `#${this.timeId}`;

    this.onDateChange = this.onDateChange.bind(this);
    this.onTimeChange = this.onTimeChange.bind(this);
    this.onTimezoneChange = this.onTimezoneChange.bind(this);
    this.onChange = this.onChange.bind(this);
  }