Sha256: 8144761604b2c398c70e6a91282097d543d4f08d44981ccfcf990868471d7b8f

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

{I"
class:ETI"BundledAsset;FI"logical_path;TI"'tenon/features/date_time_picker.js;FI"
pathname;TI"d/Users/seanroberts/Sites/tenon/app/assets/javascripts/tenon/features/date_time_picker.js.coffee;FI"content_type;TI"application/javascript;TI"
mtime;Tl+b+SI"length;TiKI"digest;TI"%dc3c76555f4f20f25d8850544ef848d7;FI"source;TI"K(function() {
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  Tenon.features.DateTimePicker = (function() {

    function DateTimePicker() {
      this._setupUnfocus = __bind(this._setupUnfocus, this);
      this._enableDateTimePicker = __bind(this._enableDateTimePicker, this);
      this._formatDate = __bind(this._formatDate, this);      this.$els = $("[data-behaviour~='datetime-picker']");
      this.format = "MMM. DD, YYYY [at] hh:mm A";
      $.each(this.$els, this._formatDate);
      this._enableDateTimePicker();
      this._setupUnfocus();
    }

    DateTimePicker.prototype._formatDate = function(i, el) {
      var $el, railsFormat, reformatted;
      $el = $(el);
      if ($el.val() !== '' && $el.val().match(/^\d{4}\-\d{2}\-\d{2}.*$/)) {
        railsFormat = "YYYY-MM-DD HH:mm:ss ZZ";
        reformatted = moment($el.val(), railsFormat).format(this.format);
        return $(el).val(reformatted);
      }
    };

    DateTimePicker.prototype._enableDateTimePicker = function() {
      return this.$els.datetimepicker({
        pick12HourFormat: true,
        pickSeconds: false,
        format: this.format
      });
    };

    DateTimePicker.prototype._setupUnfocus = function() {
      return this.$els.attr('readonly', true);
    };

    return DateTimePicker;

  })();

}).call(this);
;TI"required_assets_digest;TI"%194830e29e917ac032aa805e54995791;FI"
_version;TI"%a56df69ef97ba4d9f1a23bf9b0add58a;F

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
tenon-1.0 spec/dummy/tmp/cache/assets/development/sprockets/36656e0017c1ee507cf36ebeff3ea4d2
tenon-1.0 spec/dummy/tmp/cache/assets/development/sprockets/98c61db4906142214c2e786701a8d4cc