Git Product home page Git Product logo

Comments (10)

myusuf3 avatar myusuf3 commented on August 28, 2024

I wasn't aware of this behaviour and something I will have to look into the usage of dateutil.

from delorean.

gordol avatar gordol commented on August 28, 2024

this is related also to this bug i think? #99

from delorean.

myusuf3 avatar myusuf3 commented on August 28, 2024

@gordol was this related, can this be closed?

from delorean.

gordol avatar gordol commented on August 28, 2024

It's a dateutil issue upstream. Not fixed and they aren't planning to fix any time soon it seems.

from delorean.

myusuf3 avatar myusuf3 commented on August 28, 2024

@gordol did they give a reason?

from delorean.

gordol avatar gordol commented on August 28, 2024

i think this is actually a different bug...

dateutil/dateutil#149 (comment)

that is the reason given. basically, it implements an old RFC.

from delorean.

gordol avatar gordol commented on August 28, 2024

delorean basically just implements dateutil.parser.parse

This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element of a date/time stamp is omitted, the following rules are applied: - If AM or PM is left unspecified, a 24-hour clock is assumed, however, an hour

on a 12-hour clock (0 <= hour <= 12) must be specified if AM or PM is specified.
If a time zone is omitted, a timezone-naive datetime is returned.
If any other elements are missing, they are taken from the datetime.datetime object passed to the parameter default. If this results in a day number exceeding the valid number of days per month, the value falls back to the end of the month.

Anyway, this led me down a journey into dateutil... and it seems this may have been fixed in 2.5?

dateutil/dateutil#25

currently delorean lists dateutil 2.4.2 as the required version.

however, i think there are some other issues in dateutil after 2.5.1...

so you may want to stick with 2.5.1 for now.

see the changelog here where this was fixed in 2.5.0:
https://github.com/dateutil/dateutil/blob/38232aacc3c46ef3b649ec730a2444ed13fe3894/NEWS#L150

from delorean.

gordol avatar gordol commented on August 28, 2024

2.6 has a new parsing overhaul, so maybe give it a whirl?

from delorean.

gordol avatar gordol commented on August 28, 2024

#87

from delorean.

gordol avatar gordol commented on August 28, 2024

you can pass a default date to the parse() method also... to work around this. or you can simply set the first day of your date string to "1" to be first day of month. by default it uses the current day's date.

from delorean.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.