Skip to content

Date resets to default value on Save #1259

Closed
@ashygk

Description

@ashygk

Are you requesting a feature, reporting a bug or asking a question?

bug / question

What is the current behavior?

When my survey json has a matrix dynamic with date(custom datepicker) being one of the column and set the default value to current date using onMatrixCellCreated event.
private onMatrixCellCreated(survey, options) { if (options.columnName.startsWith('Date')) { options.rowValue[options.columnName] = new Date().toLocaleDateString(); } }

When I add a matrix row and remove the date and save, the survey data still shows current date, while it should be empty / null.

survey json : { pages: [ { name: "page1", elements: [ { type: "matrixdynamic", name: "ComplexMedicalNeeds", titleLocation: "hidden", columns: [ { name: "Date", cellType: "datepicker", dateFormat: "mm/dd/yy", config: { showOn: "button", buttonImage: "assets/icons/date.svg", buttonImageOnly: true, buttonText: "Select date", maxDate: "+0D" }, inputType: "date" }, { name: "Narrative", cellType: "comment", maxLength: 2000, validators: [ { type: "text", allowDigits: true, minLength: 0, maxLength: 2000 } ] }, { name: "Actions", visibleIf: "1 = 2" } ], cellType: "text", rowCount: 0, addRowLocation: "top", addRowText: "ADD COMPLEX NEED +", removeRowText: " ", confirmDelete: true, confirmDeleteText: "Are you sure you want to delete medical/nursing needs record?" } ] } ], showTitle: false, showQuestionNumbers: "off", questionErrorLocation: "bottom" }

What is the expected behavior?

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

your_code_here

Specify your

  • browser:
  • browser version:
  • surveyjs platform (angular or react or jquery or knockout or vue):
  • surveyjs version:

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions