Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language setting not working #420

Open
buyochini opened this issue Jan 27, 2025 · 3 comments
Open

Language setting not working #420

buyochini opened this issue Jan 27, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@buyochini
Copy link

buyochini commented Jan 27, 2025

Reqnroll Version

2.2.1

Which test runner are you using?

MSTest

Test Runner Version Number

3.5.1

.NET Implementation

.NET 8.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

{
"$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",

"language": {
"feature": "en-UK",
"binding": "en-UK"
},
"bindingAssemblies": [
{
"assembly": "SharedStepDefinitions"
}
]
}

Issue Description

DateTime value is returning US time format instead of UK.

eg
var strDateTime = "27/05/2019 07:20:00";
var actual = DateTime.ParseExact(strDateTime.Trim(), "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None);

Expected: 27/05/2019 07:20:00
Actual: 5/27/2019 7:20:00 AM

Steps to Reproduce

DateTime value is returning US time format instead of UK.

eg
var strDateTime = "27/05/2019 07:20:00";
var actual = DateTime.ParseExact(strDateTime.Trim(), "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None);

Expected: 27/05/2019 07:20:00
Actual: 5/27/2019 7:20:00 AM

Image

Link to Repro Project

No response

@buyochini buyochini added the bug Something isn't working label Jan 27, 2025
@buyochini
Copy link
Author

I also tried setting the below:

"language": {
"feature": "en-GB",
"binding": "en-GB"
}

@clrudolphi
Copy link
Contributor

Please see the documentation for the "language" settings in the configuration file. These only control the language to be used for the feature file and the language used when binding to Step Definition expressions. These have no effect on the thread's current culture setting (and thus won't affect how DateTime.Parse() operates).

@buyochini
Copy link
Author

buyochini commented Jan 28, 2025

@clrudolphi, thanks for the quick response, i thought Reqnoll uses similar config to specflow

with specflow settings as below, the bindingCulture config has an effect on the thread's current culture setting. When that is set i get the expected time based on the country set.

{
"bindingCulture": {
"language": "en-GB"
},
"language": {
"feature": "en-GB"
},
}

Also, please what is the right setting for the feature in UK. is it "feature": "en-GB" or "feature": "en-UK"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants