time.ts 547 字节
Newer Older
Z
zengqiao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import { observable, action } from 'mobx';

import moment from 'moment';

class TimeStore {
  @observable
  public startTime: moment.Moment;

  @observable
  public endTime: moment.Moment;

  @action.bound
  public initTime() {
    this.startTime = moment().startOf('date');
    this.endTime =  moment();
  }

  @action.bound
  public changeStartTime(value: moment.Moment) {
    this.startTime = value;
  }

  @action.bound
  public changeEndTime(value: moment.Moment ) {
    this.endTime = value;
  }
}

export const timestore = new TimeStore();