From aaa5f9885d37a369606e61a759af37f444ec606d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 25 May 2025 00:22:47 +0300 Subject: [PATCH] Reverted https://github.com/wekan/wekan/pull/5774 about due date changes. Thanks to xet7 ! Fixes #5782 --- client/components/cards/cardDate.js | 1 - client/lib/datepicker.js | 18 +++++++----------- client/lib/utils.js | 11 ----------- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js index e9f4c029e..5d255614d 100644 --- a/client/components/cards/cardDate.js +++ b/client/components/cards/cardDate.js @@ -1,4 +1,3 @@ -import { Utils } from '/client/lib/utils'; import moment from 'moment/min/moment-with-locales'; import { TAPi18n } from '/imports/i18n'; import { DatePicker } from '/client/lib/datepicker'; diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js index 84e4047f4..f298a752d 100644 --- a/client/lib/datepicker.js +++ b/client/lib/datepicker.js @@ -83,8 +83,7 @@ export class DatePicker extends BlazeComponent { { 'keyup .js-date-field'() { // parse for localized date format in strict mode - const normalizedValue = Utils.normalizeDigits(this.find('#date').value); - const dateMoment = moment(normalizedValue, 'L', true); + const dateMoment = moment(this.find('#date').value, 'L', true); if (dateMoment.isValid()) { this.error.set(''); this.$('.js-datepicker').datepicker('update', dateMoment.toDate()); @@ -92,10 +91,9 @@ export class DatePicker extends BlazeComponent { }, 'keyup .js-time-field'() { // parse for localized time format in strict mode - const normalizedValue = Utils.normalizeDigits(this.find('#time').value); const dateMoment = moment( - normalizedValue, - adjustedTimeFormat(), + this.find('#time').value, + adjustedTimeFormat(), true, ); if (dateMoment.isValid()) { @@ -106,14 +104,12 @@ export class DatePicker extends BlazeComponent { evt.preventDefault(); // if no time was given, init with 12:00 - const timeValue = Utils.normalizeDigits(evt.target.time.value); const time = - timeValue || - moment(new Date().setHours(12, 0, 0)).format('LT'); + evt.target.time.value || + moment(new Date().setHours(12, 0, 0)).format('LT'); const newTime = moment(time, adjustedTimeFormat(), true); - const dateValue = Utils.normalizeDigits(evt.target.date.value); - const newDate = moment(dateValue, 'L', true); - const dateString = `${dateValue} ${time}`; + const newDate = moment(evt.target.date.value, 'L', true); + const dateString = `${evt.target.date.value} ${time}`; const newCompleteDate = moment( dateString, `L ${adjustedTimeFormat()}`, diff --git a/client/lib/utils.js b/client/lib/utils.js index c2cd8886d..15896e5c3 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -11,17 +11,6 @@ Utils = { currentBoard.setColor(currentBoard["background-color"]); } }, - // Normalize non-Western (Persian/Arabic) digits to Western Arabic (0-9) - // This helps with date parsing in non-English languages - normalizeDigits(str) { - if (!str) return str; - const persian = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; - const arabic = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; - for (let i = 0; i < 10; i++) { - str = str.replace(persian[i], i).replace(arabic[i], i); - } - return str; - }, /** returns the current board id *
  • returns the current board id or the board id of the popup card if set */