FHIR server and FHIR client works in EU environment with locale "en-GB". both uses Hl7-R4 .NET version from Firely team.
if I set Patient's birth date something like that patientJson.BirthDate = "25-12-1970"
and then sends the request to FHIR server I get an exception:
"'Partial is in an invalid format, should use ISO8601 YYYY-MM-DDThh:mm:ss+TZ notation'. (at Patient.birthDate[0])".
But if I set patientJson.BirthDate = "1970-12-25"
everything is OK.
I can't rely on that customers (most from EU) will remember to convert in US-format date before sending to fhir server.
How can I set correct formatting (for example "en-GB") for HL7 serializer?
Tried to add this to Startup.cs
public virtual void Configure(IApplicationBuilder app)
{
var supportedCultures = new[]
{
new CultureInfo("en-US"),
new CultureInfo("en-GB"),
};
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture("en-GB"),
// Formatting numbers, dates, etc.
SupportedCultures = supportedCultures,
// UI strings that we have localized.
SupportedUICultures = supportedCultures
});
it didn't help I've googled this code
public static PartialDateTime Parse(string value)
{
try
{
var dummy = XmlConvert.ToDateTimeOffset(value);
}
catch
{
throw new FormatException("Partial is in an invalid format, should use ISO8601 YYYY-MM-DDThh:mm:ss+TZ notation");
}
but this code doesn't mean that it can not be set to use something like that "dd-mm-yyyy" for serializing/deserializing.