You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Y] I have searched the issues of this repo and believe that this is not a duplicate.
[Y] I have searched the documentation and believe that my question is not covered.
Feature Request
I came across a weird discrepancy in pendulum compared to other language supports.
MMM does not consider case-insensitivity.
Ex. -
25-Feb-2024 is correct recognizable, however, 25-feb-2024 is not. This is because months.abbreviated for MMM only corresponds to "Feb" for february.
If we consider other language like Java, this is natively supported.
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.util.Date;
class HelloWorld {
public static void main(String[] args) {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMMM-yyyy");
String dateStr = "23-FeB-2024";
Date date = null;
try {
date = formatter.parse(dateStr);
System.out.println(date);
} catch (Exception exception) {
System.out.println("Could not parse ... " + exception);
}
}
}
Traceback (most recent call last):
File "/~/pend.py", line 10, in <module>
file_date = pendulum.from_format("23-feb-2024", "DD-MMM-YYYY")
File "/~/.pyenv/versions/3.9.17/lib/python3.9/site-packages/pendulum/__init__.py", line 284, in from_format
parts = _formatter.parse(string, fmt, now(tz=tz), locale=locale)
File "/~/.pyenv/versions/3.9.17/lib/python3.9/site-packages/pendulum/formatting/formatter.py", line 409, in parse
raise ValueError(f"String does not match format {fmt}")
ValueError: String does not match format DD-MMM-YYYY
I made some changes but was unable to push to remote repository due it lack of permissions.
Changes:
Inside _get_parsed_locale_value function in file formatter.py on line 630
make, value = value.lower()
In files - src/pendulum/locales/<en, en_gb, en_us>/locale.py --> make , all MMM month to lower case for months.abbreviated.
I believe the above changes should tackle this issue.
The text was updated successfully, but these errors were encountered:
Feature Request
I came across a weird discrepancy in pendulum compared to other language supports.
MMM does not consider case-insensitivity.
Ex. -
25-Feb-2024 is correct recognizable, however, 25-feb-2024 is not. This is because
months.abbreviated
for MMM only corresponds to "Feb" for february.If we consider other language like Java, this is natively supported.
Output:
Fri Feb 23 00:00:00 GMT 2024
For pendulum --
Output:
I made some changes but was unable to push to remote repository due it lack of permissions.
Changes:
Inside
_get_parsed_locale_value
function in file formatter.py on line 630make,
value = value.lower()
In files -
src/pendulum/locales/<en, en_gb, en_us>/locale.py
--> make , all MMM month to lower case for months.abbreviated.I believe the above changes should tackle this issue.
The text was updated successfully, but these errors were encountered: