Comments (2)
You could customize DateParser
to detect it, like this:
DateParser parser = DateParser.newBuilder()
.addRule("民国(\\d{3})年", (input, matcher, dt) -> {
int offset = matcher.start(1);
int i0 = input.charAt(offset) - '0';
int i1 = input.charAt(offset + 1) - '0';
int i2 = input.charAt(offset + 2) - '0';
dt.setYear(i0 * 100 + i1 * 10 + i2 + 1911);
})
.build();
Regional format are way too many, supporting them would be a nightmare.
from dateparser.
Hi,
first and foremost I wish to thank you for your work, it really is a nice piece of work and it saved me a lot of time.
I wish to ask a question which I think is related to the one above. I'm not sure whether your answer solves my problem as I'm not really understanding it.
I would like to be able to parse months in more than just English, for example enero for January (Spanish) or luglio for July (Italian).
Very naively, I tried to simply add them to DateParserBuilder.months
, thinking I could then edit DateParser::parseMonth
, but it's not working: it recognises dicembre (same length of December) but not aprile (one character more).
How could I solve this problem? Is the rule above enough, and I'm simply not understanding it?
Thank you.
from dateparser.
Related Issues (20)
- Throw error when argument is empty String
- Wrong selection of a matching rule HOT 1
- Custom Rule Failure HOT 1
- Thank you so much for writing this library! HOT 1
- Get date format HOT 7
- Not available in maven repository HOT 1
- (How to?) Improve performance when parsing many strings in the same format
- ISO formatted string is parsed wrong HOT 4
- Parsing a date with some negative offsets raises an exception. HOT 1
- Support modern JDK versions by updating lombok to 1.18.10 (or newer) HOT 2
- preferMonthFirst is not reset when month is given greater than 12 HOT 3
- Date Parsing Rpoblem HOT 2
- Unneeded patterns/rules influence the result of the parsing
- Lombok dependency leaking into projects that use Dateparser HOT 2
- There is a problem with too large timestamp HOT 1
- Format exception HOT 1
- Weird bug - Custom date parser for parsing dates with zero prefixes
- The parser doesn't allow setting the default timezone (if timezone is not present in the string)
- Returning a hint whether the parsing was deterministic or not
- Support small timestamp. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dateparser.