Comments (5)
@WebFreak001 The reason the code gets confused is that it sees two different timezones in the string. From it's perspective, you're asking for a date which is in both the GMT+0100
timezone and in the Central European Standard Time
timezone.
This format is a really odd corner case, so your best option (if you can't change your inputs to something else) is to turn on fuzzy matching and then rely on the GMT auto-timezone parsing. So it would be
parse(
"Thu Nov 07 2019 17:00:00 GMT-0100 (UTC)",
No.ignoreTimezone,
null,
No.dayFirst,
No.yearFirst,
Yes.fuzzy
);
which gives you the correct result.
from date-parser.
uh where did you get the GMT-0100 (UTC)
from? I was only talking about matching timezone & offset names which seem to be generated from some kind of library in the wild, which I found when parsing some RSS feeds.
from date-parser.
Sorry, it was from a test I was writing. But the point remains. With the string
Thu Nov 07 2019 17:00:00 GMT+0000 (UTC)
The code doesn't hardcode the name of timezones other than GMT, so it sees two timezones defined at once: GMT+0000
and UTC
.
from date-parser.
I believe the stuff in ()
is just a comment which should be ignored by parsing apps, but I don't know in which standard that is specified. At least that's how the JS Date API works
from date-parser.
Looks like this is the standard output of the JavaScript Date.toString
method.
From this library's perspective, I don't think I can assume that any text inside of a ()
should act as a comment. I can easily imagine some weird date format like the following
Jan 3, 2020 8:30 AM (EST)
where stuff inside of the parentheses is relevant to the result.
I'm going to close this and suggest that you turn on fuzzy matching, which is designed to handle formats like this. If this does not give the correct result please let me know.
from date-parser.
Related Issues (14)
- Ignore timezone HOT 6
- Shouldn't be parse("Sep 2003") an interval? HOT 3
- Intervals support HOT 1
- new release for new dmd HOT 1
- Should support dateutil style default date
- std.experimental.allocator.common.Ternary conflict on build HOT 1
- call parse in static this() result in: Program exited with code -11 HOT 4
- Use template argument instead of theAllocator
- Selected package emsi_containers 0.9.0 does not match the dependency specification ~>0.8.0 in package dateparser.
- Allow any type of string to be parsed HOT 1
- Restructure Files
- Dead links in docs HOT 2
- Not properly handling utf-8 graphemes
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 date-parser.