Petit bug, on ne peut pas faire de match sur un number

This commit is contained in:
Christophe 2020-03-11 21:58:22 +01:00
parent ad5f38db1a
commit a788b7df4a
2 changed files with 19 additions and 16 deletions

View file

@ -31,6 +31,7 @@ const orderBy = (arr, props, orders) =>
// transforme 03/11/2000 en 20001103
let re = /^(\d{2})\/(\d{2})\/(\d{2,4})$/;
if (typeof p1 !== 'number') {
let r1 = p1.match(re);
if (Array.isArray(r1)) {
p1 = r1[3] + r1[2] + r1[1];
@ -40,6 +41,7 @@ const orderBy = (arr, props, orders) =>
if (Array.isArray(r2)) {
p2 = r2[3] + r2[2] + r2[1];
}
}
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
}
@ -88,7 +90,6 @@ let monTableau = {
},
computed: {
tableau: function() {
console.log('computed tableau');
return this.pagination(
this.table.filter(ligne => {
if (this.search) {

View file

@ -45,6 +45,8 @@ var orderBy = function orderBy(arr, props, orders) {
// transforme 03/11/2000 en 20001103
var re = /^(\d{2})\/(\d{2})\/(\d{2,4})$/;
if (typeof p1 !== 'number') {
var r1 = p1.match(re);
if (Array.isArray(r1)) {
@ -56,6 +58,7 @@ var orderBy = function orderBy(arr, props, orders) {
if (Array.isArray(r2)) {
p2 = r2[3] + r2[2] + r2[1];
}
}
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
}
@ -108,7 +111,6 @@ var monTableau = {
tableau: function tableau() {
var _this = this;
console.log('computed tableau');
return this.pagination(this.table.filter(function (ligne) {
if (_this.search) {
if (!Object.values(ligne).every(function (el) {