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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -4999,8 +4999,20 @@ $(function(){
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
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) {
@@ -5008,7 +5020,17 @@ $(function(){
},
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) {

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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -5067,8 +5067,20 @@ $(function(){
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
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) {
@@ -5076,7 +5088,17 @@ $(function(){
},
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) {

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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -4933,8 +4933,20 @@ $(function(){
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
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) {
@@ -4942,7 +4954,17 @@ $(function(){
},
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) {

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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* 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.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -2,7 +2,7 @@
"name": "x-editable-bootstrap5",
"title": "X-editable-bootstrap5",
"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",
"author": {
"name": "Micha Espey",

View File

@@ -90,8 +90,20 @@ $(function(){
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
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) {
@@ -99,7 +111,17 @@ $(function(){
},
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) {