Skip to content

AddField with type date and default value not working #1545

Closed
@mohamedGamalAbuGalala

Description

@mohamedGamalAbuGalala

New Issue Checklist

Issue Description

When adding a new field with type Date and with defaultValue it complains that the defaultValue should be with type date.

Steps to reproduce



    const newLocalSchema = new Parse.Schema('BlaSchema')
    newLocalSchema.addField('bla', 'Date', { defaultValue: new Date() })
    await newLocalSchema.save()


Actual Outcome

error: Parse error:  schema mismatch for BlaSchema.bla default value; expected Date but got String {"code":111,"stack":"Error: schema mismatch for BlaSchema.bla default value; expected Date but got String\n    at SchemaController.addClassIfNotExists

image

Expected Outcome

It should work.

Environment

Server

  • Parse Server version: ^4.10.2
  • Operating system: Windows
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): Mongo
  • Database version: v5.0.2
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): docker

Client

  • Parse JS SDK version: 3.3.0

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions