Coder Social home page Coder Social logo

Comments (3)

aviks avatar aviks commented on July 1, 2024

The typical usecase for division, I'd imagine would be date(x) - date(y)/ year(1). You'd want to multiply the result by something (eg, interest rate), which begs the question of whether the result of the division should be a bare number rather than a period (0.5 or even 1//2 instead of year(1/2))

But in real life, division is not so simple, you need to consider day count conventions (Actual/Actual or 30/365 etc ..). So I wonder if making this an error, rather than giving a naive result is better. cf: https://github.com/aviks/Ito.jl/blob/master/src/time/day_count.jl

In any case, I think / should not promote to div. They ask different questions in the domain: what fraction of of a year is a month vs how many months in a year.

from dates.jl.

StefanKarpinski avatar StefanKarpinski commented on July 1, 2024

I agree with @aviks.

from dates.jl.

quinnj avatar quinnj commented on July 1, 2024

Sounds good. To be clear, date(x) - date(y)/ year(1), is not allowed because you'd be trying to divide Day/Year. After ditching automatic Period conversions, I haven't figured out a more clean API for specifying a conversion strategy, so that's another issue for another day.

from dates.jl.

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.