{
value = this.formatDate(value);
if(!Roo.form.DateField.superclass.validateValue.call(this, value)){
+ Roo.log('super failed');
return false;
}
if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
var svalue = value;
value = this.parseDate(value);
if(!value){
+ Roo.log('parse date failed' + svalue);
this.markInvalid(String.format(this.invalidText, svalue, this.format));
return false;
}
return value;
}
var v = Date.parseDate(value, this.format);
- if (this.useIso) {
+ if (!v && this.useIso) {
v = Date.parseDate(value, 'Y-m-d');
}
if(!v && this.altFormats){
// private
menuListeners : {
select: function(m, d){
+
this.setValue(d);
this.fireEvent('select', this, d);
},
*/
setValue : function(date){
Roo.log('month setValue' + date);
+ // can only be first of month..
+
+ var val = this.parseDate(date);
+
if (this.hiddenField) {
this.hiddenField.value = this.formatDate(this.parseDate(date), 'Y-m-d');
}
// private
parseDate : function(value){
if(!value || value instanceof Date){
+ value = value ? Date.parseDate(value.format('Y-m') + '-01', 'Y-m-d') : null;
return value;
}
var v = Date.parseDate(value, this.format);
- if (this.useIso) {
+ if (!v && this.useIso) {
v = Date.parseDate(value, 'Y-m-d');
}
+ if (v) {
+ //
+ v = Date.parseDate(v.format('Y-m') +'-01', 'Y-m-d');
+ }
if(!v && this.altFormats){
var m = this.menu;
var p = m.picker;
+ // hide month picker get's called when we called by 'before hide';
+ var ignorehide = true;
p.hideMonthPicker = function(disableAnim){
- if(this.monthPicker){
+ if (ignorehide) {
+ return;
+ }
+ if(this.monthPicker){
Roo.log("hideMonthPicker called");
if(disableAnim === true){
this.monthPicker.hide();
}else{
this.monthPicker.slideOut('t', {duration:.2});
- p.setValue(new Date(m.picker.mpSelYear, m.picker.mpSelMonth));
+ p.setValue(new Date(m.picker.mpSelYear, m.picker.mpSelMonth, 1));
p.fireEvent("select", this, this.value);
m.hide();
}
Roo.log(this.getValue());
p.setValue(this.getValue() ? this.parseDate(this.getValue()) : new Date());
m.show(this.el, 'tl-bl?');
+ ignorehide = false;
+ // this will trigger hideMonthPicker..
+
// hidden the day picker
Roo.select('.x-date-picker table', true).first().dom.style.visibility = "hidden";
this.setValue(this.originalValue);
this.clearInvalid();
this.lastData = false;
+ if (this.view) {
+ this.view.clearSelections();
+ }
},
// private
findRecord : function(prop, value){