Sha256: d5c6c1f112c3ae92c06b8b3f9c993c19144a041a3b2f7b9d37c8628b0f582c55

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

Spider.defineWidget('Spider.Forms.DateTime', {
	
	autoInit: true,
	
	ready: function(){
	    var conf = {};
        this.input = this.el;
	    if (this.el.is('.change-month')) conf.changeMonth = true;
	    if (this.el.is('.change-year')) conf.changeYear = true;
        var classes = this.el.attr('class').split(' ');
        for (var i=0; i<classes.length; i++){
            var cl = classes[i];
            if (cl.substr(0, 10) == 'year-range'){
                var range = cl.substr(11).split('-');
                conf.yearRange = range[0].replace("m", "-")+":"+range[1].replace('p', '+');
                a = 3;
            }
        }
		if (this.input.is('.date')) this.input.datepicker(conf);
		else if (this.input.is('.date_time')){
			var el = this.input;
			el.hide();
			var val = el.val().split(' ');
			if (!val[1]) val[1] = '';
			var d = $('<input type="text" class="date" size="10" />').val(val[0]).insertAfter(el).datepicker(conf);
			var span = $('<span> </span>').insertAfter(d);
			var t = $('<input type="text" class="time" size="8" />').val(val[1]).insertAfter(span);
			var updateDt = function(){
				el.val(d.val()+' '+t.val());
			};
			d.change(updateDt);
			t.change(updateDt);
		}
	}
    
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spiderfw-0.6.26 apps/core/forms/public/date_time.js
spiderfw-0.6.26.pre1 apps/core/forms/public/date_time.js