Skip to content

Date editor prevents saving cleared/empty valuesΒ #489

@bogdankhamelyuk

Description

@bogdankhamelyuk

Is this a regression?

Yes

Severity

🟠 Major – significantly affects usability

Please provide the branch(es) you discovered this issue in

v93

Environment Details

v93

Please provide a minimal set of steps to reproduce the issue

  1. data administration
  2. (select identity)
  3. open "organizational information"
  4. set "temporarily inactive from" to some date
  5. save

Description

now repeat steps 2-3 and try to clear "temporarily inactive from" field of the previous selected identity and save it.

Describe what you expected to happen versus what actually happened

I expected to see empty values, instead i see the same date, which was initially set.

Suggested Fix

i suggest to use if-conditioning from the 14th aug 61dc999cbda4592747578901034479da21570327

//imxweb/projects/qbm/src/lib/cdr/edit-date/edit-date.component.ts
private async writeValue(value: Moment | undefined): Promise<void> {
    const resetMoment = this.resetValue ? moment(this.resetValue) : undefined;
    if (this.control.errors || value?.isSame(this.previousValue)) {
      return;
    }

// rest of the code
}

the current if-condition is

 const resetMoment = this.resetValue ? moment(this.resetValue) : undefined;
    if (this.control.errors || value?.isSame(resetMoment) || (value === resetMoment && !value)) {
      return;
    }

and (value === resetMoment && !value) is what says "if both are empty, ignore it" β†’ Blocks saving empty values

Anything else?

No response

Before submitting...

  • I have searched for existing issues that match this one on github and on the community support page
  • I have included all necessary details to reproduce this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions