GithubHelp home page GithubHelp logo

datetime_diff's Introduction

Travis CI Build status codecov PyPI PyPI PyPI

The datetime_diff package provides a useful function for comparing two different datetime objects and returns the time elapsed since.

for example, a datetime object when turned into a string (being 2015-12-03 03:34:57.281000) when compared with a new datetime object (equivalent to the current time) one can determine how many years, months, days, hours, minutes, and seconds ago the prior datetime object was.

This returns the data as a string readable by humans denoting how much time has passed since the specified prior datetime object.

datetime_diff's People

Contributors

arahaan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

datetime_diff's Issues

Bug on calcuating elapsed time.

There is currently a bug when an minute, hour, day, month, or even year changes.

============================= test session starts ==============================
platform linux -- Python 3.6.0, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /home/travis/build/AraHaan/datetime_diff, inifile: setup.cfg
plugins: timeout-1.2.0, mock-1.5.0, cov-2.4.0
timeout: 50.0s method: signal
collected 1 items 
tests/test_datetime_diff.py F
----------- coverage: platform linux, python 3.6.0-final-0 -----------
Name                        Stmts   Miss  Cover
-----------------------------------------------
datetime_diff/__init__.py      72     42    42%
Coverage HTML written to dir htmlcov
=================================== FAILURES ===================================
______________________________ test_datetime_diff ______________________________
    def test_datetime_diff():
        oldnow = datetime.datetime.now()
        time.sleep(15)
        newnow = datetime.datetime.now()
>       assert datetime_diff.datetime_diff(oldnow, newnow) == "15 seconds ago."
E       AssertionError: assert '1 minute ago.' == '15 seconds ago.'
E         - 1 minute ago.
E         + 15 seconds ago.
tests/test_datetime_diff.py:15: AssertionError
========================== 1 failed in 15.10 seconds ===========================

I think what is needed to be done is that I need to convert the datetime objects to absolute seconds on every unit and then calculate how much time has passed. And then after that figure out how to convert it all back from seconds. It needs work and someone who knows how to do the conversions I need for this.

builds fail on travis.

@fafhrd91 have any idea why make cov-dev-full fails on travis here but not for aiohttp?

Something makes me think something is not properly setup on here. I been looking into things and build testing similar to how aiohttp is set up.

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.