Skip to content

fix: flatpickr correctly parsing dates #1954

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

Merged
merged 2 commits into from
Jul 26, 2025

Conversation

johannesMEGABAD
Copy link
Contributor

⚡ PowerGrid - Pull Request

  • Bug fix
  • Enhancement
  • New feature
  • Breaking change

Description

Let's say you use the format "d.m.Y" in the flatpickr config. What happened before was that the $makeDate function used

$date = Carbon::createFromFormat($dateFormat, $dateStr, $appTimezone);

However in the pg-flatpickr.js it already parses it to the format of "Y-m-d"

selectedDates = selectedDates.map((date) => this.element.formatDate(date, 'Y-m-d'));

This ultimately results in the $makeDate function trying to use the createFromFormat function on a date that is in the format of d.m.Y with the format being Y-m-d.

This pr fixes this by switching from createFromFormat to simply parse.

Related Issue(s):

Documentation

This PR requires Documentation update?

  • Yes
  • No
  • I have already submitted a Documentation pull request.

@luanfreitasdev luanfreitasdev merged commit ed2593d into Power-Components:6.x Jul 26, 2025
23 checks 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.

2 participants