<commit_before>import Ember from 'ember';

export default Ember.TextField.extend({
  tagName: 'input',
  classNames: 'pickadate',
  attributeBindings: [ "name", "type", "value", "id", 'required', 'pattern', 'placeholder'],

  didInsertElement: function(){
    var _this = this;
    var date = new Date();
    Ember.$().ready(function(){
      Ember.$('.pickadate').pickadate({
        format: 'ddd mmm d',

        disable: [ 1, 2 ],
        min: [date.getUTCFullYear(), date.getMonth(), date.getDate()],
        clear: false,
        today: false,
        close: false,
        // editable: true,
        onSet: function() {
          var date = this.get('select') && this.get('select').obj;
          _this.set("selection", date);
          Ember.$('#selectedTime').val('');

          if(date) {
            var selectedDate = date;
            var currentDate = new Date();
            currentDate.setHours(0,0,0,0);
            selectedDate.setHours(0,0,0,0);

            if(selectedDate.getTime() === currentDate.getTime()) {
              var currentTime = new Date();
              var hours = currentTime.getHours();
              var minutes = currentTime.getMinutes();
              minutes = minutes > 30 ? 30 : 0;
              var total_mins = hours*60 + minutes;
              total_mins = total_mins > 960 ? 960 : total_mins;

              // disabled all previous options
              Ember.$("#selectedTime option[value="+total_mins+"]").prevAll().each(function() {
                  Ember.$( this ).prop('disabled', true);

                });
              // disable current option
              Ember.$("#selectedTime option[value="+total_mins+"]").prop('disabled', true);

            } else {
              Ember.$("#selectedTime option").each(function() {
                  Ember.$( this ).removeAttr( "disabled" );
                });
            }
          }
        },
        onStart: function(){
          var date = _this.get('selection');
          if(date) {
            this.set('select', new Date(date), { format: 'ddd mmm d' });
          }
        }
      });
    });

  }<commit_msg>removed disabled hours from Time dropdown<commit_after>import Ember from 'ember';

export default Ember.TextField.extend({
  tagName: 'input',
  classNames: 'pickadate',
  attributeBindings: [ "name", "type", "value", "id", 'required', 'pattern', 'placeholder'],

  currentMinutes: function(){
    var currentTime = new Date();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes() > 30 ? 30 : 0;;
    var total_mins = hours*60 + minutes;
    return (total_mins > 960) ? 960 : total_mins;
  },

  didInsertElement: function(){
    var _this = this;
    var date = new Date();

    Ember.$().ready(function(){
      Ember.$('.pickadate').pickadate({
        format: 'ddd mmm d',

        disable: [ 1, 2 ],
        min: [date.getUTCFullYear(), date.getMonth(), date.getDate()],
        clear: false,
        today: false,
        close: false,
        // editable: true,

        onOpen: function() {
          var currentMins = _this.currentMinutes();
          if(currentMins === 960) { this.set("disable", [new Date])}
        },

        onSet: function() {
          var date = this.get('select') && this.get('select').obj;
          _this.set("selection", date);
          Ember.$('#selectedTime').val('');

          if(date) {
            var selectedDate = date;
            var currentDate = new Date();
            currentDate.setHours(0,0,0,0);
            selectedDate.setHours(0,0,0,0);

            if(selectedDate.getTime() === currentDate.getTime()) {
              var total_mins = _this.currentMinutes();
              // disabled all previous options
              Ember.$("#selectedTime option[value="+total_mins+"]").prevAll().each(function() {
                  Ember.$( this ).addClass("hidden");
              });
              // disable current option
              Ember.$("#selectedTime option[value="+total_mins+"]").addClass("hidden");
            } else {
              Ember.$("#selectedTime option").each(function() {
                  Ember.$( this ).removeClass("hidden");
                });
            }
          }
        },
        onStart: function(){
          var date = _this.get('selection');
          if(date) {
            this.set('select', new Date(date), { format: 'ddd mmm d' });
          }
        }
      });
    });

  }
{'fraction_non_alphanumeric': 0.1600090273076055, 'fraction_numerical': 0.011058451816745656, 'mean_word_length': 1.9273447820343461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1647056', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1256, 'n_words': 275}