Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Incorrect data-value (12-00-2025, ...) in Date Selection. #2944

Open
4 tasks done
ibragims opened this issue Jan 13, 2025 · 0 comments
Open
4 tasks done

Issue with Incorrect data-value (12-00-2025, ...) in Date Selection. #2944

ibragims opened this issue Jan 13, 2025 · 0 comments
Labels
State: Triage Tickets that need to be triaged. Type: Bug

Comments

@ibragims
Copy link

Prerequisites

  • I have searched for duplicate or closed issues.
  • I have validated my setup against the latest version on StackBlitz.
  • I have read the contributing guidelines.
  • I understand that only sponsored issues will be worked on and that if I wish to sponsor an issue, I will contact the owner FIRST.

Describe the issue

I recently encountered an issue while selecting a date in the system. The data-value being generated for the selected date was incorrect. For example, when I selected January 12, 2025, the system returned 12-00-2025 instead of the correct value.

After investigating, I discovered that the issue was due to the month value not being properly adjusted. It seems the month index was not incremented by 1, which is required since months in many programming languages (like JavaScript) are zero-based.

I was able to resolve this on my end by adding a month conversion adjustment (+1) in the code. However, I wanted to bring this to your attention in case other users might be affected.

Original code:

      _dateToDataValue(date) {
          if (!DateTime.isValid(date))
              return '';
          return `${date.year}-**${date.month.toString().padStart(2, '0')}**-${date.date
            .toString()
            .padStart(2, '0')}`;
      
```}

Here is the corrected code:
 _dateToDataValue(date) {
      if (!DateTime.isValid(date)) return '';
	  **let setMonth = parseInt(date.getMonth() + 1).toString().padStart(2, '0');**
	  return `${date.year}-**${setMonth}**-${date.date.toString().padStart(2, '0')}`;
  };

### StackBlitz fork

Jquery

### What operating system(s) are you seeing the problem on?

Windows

### What browser(s) are you seeing the problem on?

Firefox

### What version of are you using? You can find this information from the sample StackBlitz.

v6.9.11

### What your browser's locale? You can find this information from the sample StackBlitz.

en-BE
@ibragims ibragims added State: Triage Tickets that need to be triaged. Type: Bug labels Jan 13, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in Tempus Dominus Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: Triage Tickets that need to be triaged. Type: Bug
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant