Skip to content

Set null to datetime value breaks #18099

Closed

Description

@dkrahn

Bug Report

Ionic version:
[x] 4.x

Current behavior:
Pass null value to datetime breaks component.

Expected behavior:
Be able to pass null to component without breaking it.

Steps to reproduce:
Add <ion-datetime [value]="null"></ion-datetime>, the console will show error, once opened, cannot close it.

Related code:
From what I can see the problem is in this point:
https://github.com/ionic-team/ionic/blob/a5b9066fee1a3cc01fc2aab524bb979fb0096de2/core/src/components/datetime/datetime-util.ts#L280-L285
The test !newData is true for null and undefined, but the method getLocalDateTime has a default value when undefined is passed, but not when null is.

Other information:
<ion-datetime [value]="undefined"></ion-datetime> works fine.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (****\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.3.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 ([email protected])
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (****\AppData\Local\Android\Sdk)
   NodeJS            : v8.11.4 (****\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

Activity

  1. changed the title [-]bug: [/-] [+]Set null to datetime value breaks[/+] on Apr 22, 2019
  2. liamdebeasi commented on Apr 23, 2019

    @liamdebeasi
    Contributor

    Thanks for the issue! I've created a PR for it here: #18105

  3. added
    package: core
    type: bug
    on Apr 23, 2019
  4. liamdebeasi commented on Apr 23, 2019

    @liamdebeasi
    Contributor

    This issue has been fixed by #18105 and will be in the next release of Ionic.

    Thanks for using Ionic!

  5. added 4 commits that reference this issue on May 8, 2019
    5eb942f
    71d5400
    2c24df2
    9c65d5d
  6. added a commit that references this issue on May 22, 2019
    3da7254
  7. ionitron-bot commented on May 23, 2019

    @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.

  8. locked and limited conversation to collaborators on May 23, 2019
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