Skip to content

fix(64164): Prevent default date parsing#2

Merged
EtienneLeco merged 3 commits into360l-fixesfrom
dev-64164
Mar 19, 2026
Merged

fix(64164): Prevent default date parsing#2
EtienneLeco merged 3 commits into360l-fixesfrom
dev-64164

Conversation

@EtienneLeco
Copy link
Copy Markdown

@EtienneLeco EtienneLeco commented Dec 29, 2025

Issue: https://github.com/360Learning/platform/issues/64164

Context

v-calendar is a lib we use for our datePicker components. It is not well maintained and we had to create a fork from the official lib.
v-calendar contains some logic to parse a string as a date against a language and a format.
In case the string does not match any format. A last try is done with new Date(<dateAsString>). As this logic introduces a bug, this PR removes this part of the logic.

The bug

in french 12/24/2024 does not match format DD/MM/YYYY (because 24 cannot be a valid month) so we should expect an error of parsing. Instead we get December 24th 2024 (because of new Date("12/24/2024"))

Changes

  • Add vitest to run test (because I am more efficient with it)
  • add test to cover the bug
  • remove the logic to fix the bug

Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

Comment thread src/utils/locale.js

parse(dateString, mask) {
const masks = this.normalizeMasks(mask);
return (
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[reviewers] Hide whitespace

Copy link
Copy Markdown

@NemausatTara NemausatTara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EtienneLeco , clear 👌

Comment thread src/utils/locale.spec.ts
Comment thread src/utils/locale.js
@EtienneLeco EtienneLeco merged commit 9f2c3c7 into 360l-fixes Mar 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants