Closed vishal24tuniki closed 6 months ago
I am marshalling a proto message using the below code
Print of a proto struct instance
code:{coding:{system:{value:"https://snomed.info/sct"} code:{value:"d-5007465174"}} coding:{system:{value:"http://mdb.eka.care/technical"} code:{value:"d-5007465174"} display:{value:"COVID-19"}}} subject:{patient_id:{value:"oid"}} onset:{date_time:{value_us:1577836800 timezone:"Asia/Kolkata" precision:SECOND}} recorded_date:{value_us:1713875467 timezone:"Asia/Kolkata" precision:SECOND}
Code
import "github.com/google/fhir/go/jsonformat" jsonMarshaller, _ := jsonformat.NewMarshaller(false, "", "", fhirversion.R4) encodedResource, _ := jsonMarshaller.MarshalResource(resource) // resource is the above instance print(string(encodedResource))
Above print output
{"code":{"coding":[{"code":"d-5007465174","system":"https://snomed.info/sct"},{"code":"d-5007465174","display":"COVID-19","system":"http://mdb.eka.care/technical"}]},"onsetDateTime":"1970-01-01T05:56:17+05:30","recordedDate":"1970-01-01T05:58:33+05:30","resourceType":"Condition","subject":{"reference":"Patient/oid"}}
The issue is the value of recorded_date in proto model is 1713875467, while after marshal, it's becoming 1970-01-01T05:58:33+05:30 I am unsure what's causing the issue though the code is straighforward. Similar is the case with onset.
Request help to help me correct this.
I am marshalling a proto message using the below code
Print of a proto struct instance
Code
Above print output
The issue is the value of recorded_date in proto model is 1713875467, while after marshal, it's becoming 1970-01-01T05:58:33+05:30 I am unsure what's causing the issue though the code is straighforward. Similar is the case with onset.
Request help to help me correct this.