Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

datepicker: invalid value on first load from moment #12118

Open

Description

@j-walker23

Bug Report

Demo URL (required)*: https://datepicker-invalid-value-on-first-load-from-string-12075-pskwl4.stackblitz.io

Detailed Reproduction Steps

  1. Start date as moment object

List the affected versions of AngularJS, Material, OS, and browsers

  • AngularJS: 1.8.2
  • AngularJS Material: 1.2.3
  • OS: All
  • Browsers: All
  • Screen Readers:

Add anything else we should know

This was just fixed for string being the default last version.
I added the below to that ticket, but I added it too late. I should have just opened a new ticket. Sorry about that.

When DatePickerCtrl.prototype.updateErrorState is called with a moment date
if (this.dateUtil.isValidDate(date)) { is false
So this.ngModelCtrl.$setValidity('valid', date == null); runs and the ngModel ctrl valid key is set to false.

Activity

  1. added
    needs triage
    on Aug 8, 2021
  2. changed the title [-]datepicker: invalid value on first load from string[/-] [+]datepicker: invalid value on first load from moment[/+] on Aug 8, 2021
  3. self-assigned this
    on Nov 18, 2021
  4. added this to the 1.2.5 milestone on Nov 18, 2021
  5. added
    P2: required
    and removed
    needs triage
    on Nov 18, 2021
  6. Splaktar commented on Nov 18, 2021

    @Splaktar
    Contributor

    Thank you for opening this issue. Sorry that I didn't notice your comment in #12075 and address that as well in PR #12115.

  7. modified the milestones: 1.2.5, 1.2.6 on Dec 21, 2021
  8. matrium0 commented on Jan 2, 2022

    @matrium0

    @Splaktar it seems this bug is also present if you use the Luxon Adapter instead of the Moment Adapter

  9. Splaktar commented on Jan 2, 2022

    @Splaktar
    Contributor

    @matrium0 AngularJS Material doesn't have an official Luxon adapter. Which are you using?

  10. matrium0 commented on Jan 3, 2022

    @matrium0

    Ah sorry, I noticed a similar bug in MatLuxonDateModule (installed via @angular/material-luxon-adapter) for Angular not AngularJS.

    My bad! (still I choose to blame it a tiny little bit on the choice to "keep the name" Angular :D ). Thanks for your quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2: requiredtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions