Skip to content

bug: Ionic 6 - Ion-Datetime UI should not be solid blue for todays date when no value set #24456

Closed

Description

@bkarv

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

On Ionic 6 and to be honest its a bit harsh to call it a bug. But in short when in popover mode when the user clicks on the text or input date field to open up the new ion-datetime UI. If no value is selected, the date defaults to today's date. This is fine however the circle is blue solid which visually means the user has selected the date already which is incorrect. This could cause confusion.

Screen Shot 2021-12-21 at 5 33 13 pm

Expected Behavior

If no value set, the default today's date should be a blue outline circle not a solid circle. See below correct expected behaviour.

Screen Shot 2021-12-21 at 5 33 00 pm

Steps to Reproduce

Test new ionic datetime using a ngModel value set to "" or null. I tested in popover mode in Angular 13:

<ion-item class="ion-text-wrap" button="true" id="ionic-date-start">
                        <ion-icon name="calendar" slot="start"></ion-icon>
                         <ion-label style="color:#424242">Start Date</ion-label>
                         <ion-text>{{record.start_date|date:'mediumDate'}}</ion-text>

                        <ion-popover trigger="ionic-date-start" show-backdrop="false">
                          <ng-template>
                            <ion-datetime
                              #popoverDatetime
                              presentation="date"
                              [showClearButton]="true"
                             [(ngModel)]="record.start_date"
                            ></ion-datetime>
                          </ng-template>
                        </ion-popover>
                      </ion-item>

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.15.0 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.1
@angular-devkit/build-angular : 13.0.2
@angular-devkit/schematics : 13.0.2
@angular/cli : 13.0.2
@ionic/angular-toolkit : 5.0.3

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v16.13.1 (/usr/local/bin/node)
npm : 8.1.1
OS : macOS Big Sur
Xcode : Xcode 13.2.1 Build version 13C100

─────────────────────────────────────────────────

Additional Information

No response

Activity

  1. added
    holiday triage
    on Dec 21, 2021
  2. ionitron-bot commented on Dec 21, 2021

    @ionitron-bot

    Thanks for the issue! This issue has been labeled as holiday triage. With the winter holidays quickly approaching, much of the Ionic Team will soon be taking time off. During this time, issue triaging and PR review will be delayed until the team begins to return. After this period, we will work to ensure that all new issues are properly triaged and that new PRs are reviewed.

    In the meantime, please read our Winter Holiday Triage Guide for information on how to ensure that your issue is triaged correctly.

    Thank you!

  3. changed the title [-]bug: Ionic 6 - Ionic Datetime modal/popover should not be solid blue when no value set[/-] [+]bug: Ionic 6 - Ionic Datetime UI should not be solid blue for todays date when no value set[/+] on Dec 21, 2021
  4. changed the title [-]bug: Ionic 6 - Ionic Datetime UI should not be solid blue for todays date when no value set[/-] [+]bug: Ionic 6 - Ion-Datetime UI should not be solid blue for todays date when no value set[/+] on Dec 21, 2021
  5. sean-perkins commented on Jan 5, 2022

    @sean-perkins
    Contributor

    Hello @bkarv thank for reporting this issue.

    Currently the datetime component will set the default value to today's date, which acts similar to the browser's implementation of datetime-locale.

    I don't currently believe this is a bug. I believe this could be better classified as a feature to prevent setting the default date value to today. This would achieve the visual display you are expecting.

    Does that feel fair?

  6. added
    needs: reply
    on Jan 5, 2022
  7. removed
    holiday triage
    on Jan 5, 2022
  8. bkarv commented on Jan 17, 2022

    @bkarv
    Author

    thanks for replying as mentioned previously bit harsh to call this a bug. I happy if this can be classified as a feature request cheers.

  9. added and removed
    needs: reply
    on Jan 17, 2022
  10. averyrousseau commented on Jan 24, 2022

    @averyrousseau
    Contributor

    I took another look at this, and confirmed that if no value is specified on the ion-datetime, it defaults to undefined, but the visual display still shows a blue circle on today's date. Also, manually setting the value to something falsy after the fact doesn't update the display -- for example, you could set it to tomorrow, and then null, and the display still highlights tomorrow with the solid blue circle.

    I agree that this feels odd 🤔 There are a couple ways we could go about fixing this...

    If no initial value is set, the datetime should either automatically initialize with a value of today, or not highlight any day and just show the outline around today.

    And then if the value is manually set to something falsy, either there should be an error with no further action, the solid blue circle should go away (leaving just the outline), or the value should automatically switch to today. How we handle this will likely depend on how the first problem is handled.

    Either way, I agree that the implementation should be improved here. I'll go ahead and file it as a bug so we can take a deeper look.

  11. added
    package: core
    type: bug
    on Jan 24, 2022
  12. bkarv commented on Feb 7, 2022

    @bkarv
    Author

    @amandasmith3 thanks for the comments and detailed response. What you have propose make sense, I look forward to the investigation and final solution.

  13. tetsuwanadam commented on Apr 2, 2022

    @tetsuwanadam

    Agreed that the current UI of highlighting the current day with a solid blue circle even when there's no value is confusing. On init if there's no value the current day should have an outline around it, as @amandaesmith3 suggests.

  14. averyrousseau commented on Apr 19, 2022

    @averyrousseau
    Contributor

    Hi all, could you try the below dev build and let me know if it resolves things on your end?

    6.1.2-dev.11650392645.12c652f6
    

    Example:

    npm install @ionic/[email protected]
    
  15. averyrousseau commented on Apr 26, 2022

    @averyrousseau
    Contributor

    This has been resolved via #25151, and the fix will be available in a future release of Ionic 👍

  16. ionitron-bot commented on May 26, 2022

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  17. locked and limited conversation to collaborators on May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions