Skip to content

DateTime Parsing Issues When System Locale Is Not US English #1323

@AmBplus

Description

@AmBplus

Hi,

I have encountered a problem with this package regarding DateTime parsing and formatting. If the system's locale or calendar is not set to US English (for example, if it is set to Persian), the package throws unexpected errors or behaves incorrectly when handling dates and times.

This makes it very difficult to use the library in environments where the locale is not en-US. Ideally, the package should explicitly use CultureInfo.InvariantCulture or enforce ISO/US formats when parsing and formatting DateTime values to avoid these issues.

Steps to reproduce:


// Set CultureInfo To Persian
CultureInfo persianCulture = new CultureInfo("fa-IR");
Thread.CurrentThread.CurrentCulture = persianCulture;
Thread.CurrentThread.CurrentUICulture = persianCulture;
using var minio = new MinioClient()
    .WithEndpoint("your address", 900)
    .WithCredentials("Access", "Secret")
    //.WithSSL()
    .Build();


var listBuckets = await minio.ListBucketsAsync();
var testName = Guid.NewGuid().ToString().Substring(0, 10);
await minio.MakeBucketAsync(new Minio.DataModel.Args.MakeBucketArgs().WithBucket(testName));

var listBuckets1 = await minio.ListBucketsAsync();

Change the system's locale to a non-US setting (for example, Farsi/Iran).
Try to use the package for any operation that involves DateTime parsing or formatting.
Expected behavior: DateTime operations should work regardless of the system's locale.

Actual behavior: Unexpected exceptions or errors related to date parsing/formatting.

Suggestion: Please ensure that all DateTime parsing and formatting uses CultureInfo.InvariantCulture or a fixed, robust format.

Error such as
"Object reference not set to an instance of an object."

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions