Encounter Post API - Date is saving as current date instead of data passed

Situation
I have been working with the API for Encounter, the date always defaults to today instead of the one passed on the POST API. please help

For example:
{
“date”: “2020-11-10”,
“onset_date”: “”,
“reason”: “Pregnancy Test”,
“facility”: “Owerri General Hospital”,
“pc_catid”: “5”,
“facility_id”: “3”,
“billing_facility”: “3”,
“sensitivity”: “normal”,
“referral_source”: “”,
“pos_code”: “0”,
“external_id”: “”,
“provider_id”: “1”,
“class_code”: “AMB”
}

the date that is being saved to the db is the current date instead of “date”: “2020-11-10”.

Please help!
OpenEMR Version
I’m using OpenEMR version 6.1.0

Browser:
I’m using:

Operating System
I’m using: LINUX

Logs
Did you check the logs? no error
Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All

Here is the code used for the standard api to insert a new encounter: openemr/EncounterService.php at daf6815e504bd48fdf718f3d0f09b80c500de86a · openemr/openemr · GitHub

It looks like if you want to update the date, you’ll have to do an update request with the standard api. Note that if you use the update api whatever OpenEMR user you are using needs the date_a permission as seen here: openemr/EncounterService.php at daf6815e504bd48fdf718f3d0f09b80c500de86a · openemr/openemr · GitHub

I do not know why someone had the standard api default to the current date. That may be a bug and you can send us a pull request to change it if you’d like.

thanks for the reply, after adding the encounter, i tried to us the PUT method and tried to edit the date but it seems like its returning an error

error is:
{

"validationErrors": {

    "user": {

        "Required::NON_EXISTENT_KEY": "user must be provided, but does not exist"

    },

    "group": {

        "Required::NON_EXISTENT_KEY": "group must be provided, but does not exist"

    }

},

"internalErrors": [],

"data": []

}

Hey Stephen, i created a pull request with branch name encounter_api_fix fix for insertEncounter, always creates an encounter with the curren… by reymondko · Pull Request #5873 · openemr/openemr · GitHub