-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(isDate): Enhance Date declaration compatibility across multiple environments #2231
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2231 +/- ##
==========================================
- Coverage 99.95% 99.87% -0.09%
==========================================
Files 107 107
Lines 2405 2414 +9
Branches 604 607 +3
==========================================
+ Hits 2404 2411 +7
- Misses 0 1 +1
- Partials 1 2 +1
☔ View full report in Codecov by Sentry. |
@chriso @profnandaa Can you please take a look at this PR? It's pretty small but with a big impact, validation is broken in multiple places for React Native - Android env due to this |
Sorry about that, will take a look by this weekend.
./na
…On Wed, Jun 7, 2023, 11:47 StanislavSava ***@***.***> wrote:
@chriso <https://github.com/chriso> @profnandaa
<https://github.com/profnandaa> Can you please take a look at this PR?
It's pretty small but with a big impact, validation is broken in multiple
places for React Native - Android env due to this
—
Reply to this email directly, view it on GitHub
<#2231 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB7ZEMMK5FHE4ZLJFD3O73XKA52DANCNFSM6AAAAAAY4NJUSM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the contrib! 🎉
@profnandaa We've noticed that the latest changes haven't been published yet. Our project relies heavily on these updates, and we are eagerly waiting to integrate them. Could you provide an estimate on when we can expect the new version to be published? It would greatly assist us in planning our development process. Thank you. |
feat(isDate): Enhance Date declaration compatibility across multiple environments
The issue occurred with the date declaration in the React Native - Android environment, specifically when using the following format:
new Date(
${dateObj.m}/${dateObj.d}/${dateObj.y}).getDate() === +dateObj.d;
In JavaScript, the Date constructor parses a string argument in a platform-dependent way, and it may not parse the string identically across different environments, such as various browsers or operating systems. The date format ('mm/dd/yyyy') used in the current code is very U.S.-centric and isn't guaranteed to work consistently across all systems or locales.
According to the ECMAScript specification, the only string format required to be parsed accurately across all platforms is a variant of the ISO 8601 format: 'YYYY-MM-DDTHH:mm:ss.sssZ'. Any other format may produce inconsistent results, depending on the system's implementation.
In scenarios where the year is represented with two digits (e.g., 95, 00, 18), we have introduced a check to correctly prepend it with either '20' or '19', thus maintaining accuracy and compatibility.
This enhancement aims to increase the reliability of the isDate feature across multiple environments and bring the codebase closer to established standards.
Checklist