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

Change JsDate.ToString to follow Date prototype logic #1425

Merged
merged 4 commits into from
Feb 7, 2023

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Feb 7, 2023

fixes #1424

@@ -56,6 +56,6 @@ public override string ToString()
return "Infinity";
}

return ToDateTime().ToString("ddd MMM dd yyyy HH:mm:ss 'GMT'zzz", CultureInfo.InvariantCulture);
return _engine.Realm.Intrinsics.Date.PrototypeObject.ToDateString(DateValue).ToString();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do other JS object follow this pattern?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meaning JsNumber, ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well the primitives are quite limited with toString, should we just ignore this - don't you like the behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well JsNumber does follow JS semantincs:

    public override string ToString()
    {
        return TypeConverter.ToString(_value);
    }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use TypeConverter here too

@sebastienros
Copy link
Owner

Not sure we need the new dependency. I love the library, use it in Fluid also, but in this case we just need a culture info, we can just use a string that is known from both linux and windows in dotnet core.

@lahma lahma merged commit 12bc40e into sebastienros:main Feb 7, 2023
@lahma lahma deleted the jsdate-tostring branch February 7, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cfg.LocalTimeZone not work
2 participants