added a datepicker fix

This commit is contained in:
Micha
2025-11-04 16:36:24 +01:00
parent 51aaa130b7
commit 68a5cefd46
17 changed files with 131 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -4997,19 +4997,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
} }
}, },
value2html: function(value, element) { value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : ''; let text = '';
Date.superclass.value2html.call(this, text, element);
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
}, },
html2value: function(html) { html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat); return this.parseDate(html, this.parsedViewFormat);
}, },
value2str: function(value) { value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : ''; if (!value) {
}, return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) { str2value: function(str) {
return this.parseDate(str, this.parsedFormat); return this.parseDate(str, this.parsedFormat);

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -5065,19 +5065,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
} }
}, },
value2html: function(value, element) { value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : ''; let text = '';
Date.superclass.value2html.call(this, text, element);
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
}, },
html2value: function(html) { html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat); return this.parseDate(html, this.parsedViewFormat);
}, },
value2str: function(value) { value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : ''; if (!value) {
}, return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) { str2value: function(str) {
return this.parseDate(str, this.parsedFormat); return this.parseDate(str, this.parsedFormat);

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -4931,19 +4931,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
} }
}, },
value2html: function(value, element) { value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : ''; let text = '';
Date.superclass.value2html.call(this, text, element);
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
}, },
html2value: function(html) { html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat); return this.parseDate(html, this.parsedViewFormat);
}, },
value2str: function(value) { value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : ''; if (!value) {
}, return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) { str2value: function(str) {
return this.parseDate(str, this.parsedFormat); return this.parseDate(str, this.parsedFormat);

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.6 /*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support. * A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable * https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */ * Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -2,7 +2,7 @@
"name": "x-editable-bootstrap5", "name": "x-editable-bootstrap5",
"title": "X-editable-bootstrap5", "title": "X-editable-bootstrap5",
"description": "A fork of x-editable for Bootstrap 5 support.", "description": "A fork of x-editable for Bootstrap 5 support.",
"version": "1.5.6", "version": "1.5.7",
"homepage": "https://git.24unix.net/tracer/x-editable", "homepage": "https://git.24unix.net/tracer/x-editable",
"author": { "author": {
"name": "Micha Espey", "name": "Micha Espey",

View File

@@ -88,19 +88,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
} }
}, },
value2html: function(value, element) { value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : ''; let text = '';
Date.superclass.value2html.call(this, text, element);
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
}, },
html2value: function(html) { html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat); return this.parseDate(html, this.parsedViewFormat);
}, },
value2str: function(value) { value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : ''; if (!value) {
}, return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) { str2value: function(str) {
return this.parseDate(str, this.parsedFormat); return this.parseDate(str, this.parsedFormat);