Git Product home page Git Product logo

Comments (2)

mbostock avatar mbostock commented on August 27, 2024

This library doesn’t implement a calendaring system per se; it relies on JavaScript’s built-in Date class, which implements the Gregorian calendar. In theory, it would be possible to extend this library to support other calendaring systems, but I don’t have a sense of how practical that would be. I see two challenges:

  1. This library calls new Date internally (see interval.js), so if you want to substitute a different Date class (such as hijri-date), you’ll need to modify the code to allow the Date constructor to be overridable. The Date substitute will also need to implement date.setTime.

  2. The built-in intervals may or may not be applicable in the non-Gregorian calendar system. Depending on which of these built-in intervals you want to reuse, the Date substitute will need to implement other methods. For example, the day interval requires date.setHours, date.setDate, date.getDate and date.getTimezoneOffset.

I do not personally plan on implementing the Hijri calendar in JavaScript, so I am going to close this issue. But, if you wish to submit a pull request to address the first issue and allow the Date constructor to be overridable, I would be happy to review it, especially if you are willing to include a demonstration showing how to use it with other calendar systems. Thank you!

from d3-time.

mrashad2017 avatar mrashad2017 commented on August 27, 2024

Hello @mbostock ,

I did some investigation in Hijri Date , I found some missing implementation need to be added as setTime, setHours, .. we request that from owner to be able to use it here.
Can you advise the best way to use external library like Hijri Date, with D3-Time. Especially if this library contain "require" function between files. If there an example you can share this will be great.

from d3-time.

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.