<commit_before>import Ember from 'ember';
import layout from '../templates/components/md-datepicker';

// TODO change to auto generated docs
// dateFormat
// required
// disabled
// selectedDate
// placeholder
// relaxValidation
// inputClass
// errorMessage
// minDate
// maxDate

export default Ember.Component.extend({
  layout,
  classNames: ['md-datepicker-group'],
  init() {
    let selectedDate = this.get('selectedDate');
    if (selectedDate) {
      this.set('_viewingDate', moment(selectedDate).toDate());
    }
    else {
      this.set('_viewingDate', moment().toDate());
    }

    return this._super(...arguments);
  },
  cut: function() {
    this.sendAction('keyUp');
  },
  paste: function() {
    this.sendAction('keyUp');
  },
  dateText: Ember.computed('selectedDate', 'format', {
    set(key, val) {
      this.set('_dateText', val);
      return val;
    },
    get() {
      let dateText = null;
      let _dateText = this.get('_dateText');
      let selectedDate = this.get('selectedDate');
      if (selectedDate) {
        dateText = moment(selectedDate).format(this.get('format'));
      }
      else {
        dateText = _dateText;
      }
      this.set('_dateText', dateText);
      return dateText;<commit_msg>Disable right click to prevent paste update issues<commit_after>import Ember from 'ember';
import layout from '../templates/components/md-datepicker';

// TODO change to auto generated docs
// dateFormat
// required
// disabled
// selectedDate
// placeholder
// relaxValidation
// inputClass
// errorMessage
// minDate
// maxDate

export default Ember.Component.extend({
  layout,
  classNames: ['md-datepicker-group'],
  init() {
    let selectedDate = this.get('selectedDate');
    if (selectedDate) {
      this.set('_viewingDate', moment(selectedDate).toDate());
    }
    else {
      this.set('_viewingDate', moment().toDate());
    }

    return this._super(...arguments);
  },
  didInsertElement() {
    // Currently unable to get right click cut/paste to work, so disable right click for now
    this.$('input').on('contextmenu', function() {
      return false;
    });

    return this._super(...arguments);
  },
  dateText: Ember.computed('selectedDate', 'format', {
    set(key, val) {
      this.set('_dateText', val);
      return val;
    },
    get() {
      let dateText = null;
      let _dateText = this.get('_dateText');
      let selectedDate = this.get('selectedDate');
      if (selectedDate) {
        dateText = moment(selectedDate).format(this.get('format'));
      }
      else {
        dateText = _dateText;
      }
      this.set('_dateText', dateText);
      return dateText;
{'fraction_non_alphanumeric': 0.150188679245283, 'fraction_numerical': 0.0, 'mean_word_length': 2.858806404657933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865830', 'n_tokens_mistral': 796, 'n_tokens_neox': 784, 'n_words': 180}