Giter VIP home page Giter VIP logo

bikram-sambat-js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

surojd bytefaucet

bikram-sambat-js's Issues

Conversion issue from AD to BS from 2021-04-01(1st April, 2021 ) to 2021-04-13 (13th April, 2021)

While converting date from 2021-04-01 to 2021-04-13 the ADToBS function returned values of Nepali dates which are one day after the actual Nepali date.
for example
ADtoBS("2021-04-10") should return 2077-12-19 but it returned 2077-12-20

I checked with different date ranges with the following code:

const datefns = require('date-fns');
const bikram = require('bikram-sambat-js')

var start = new Date("2021-04-01");
var end = new Date("2021-04-13");

var loop = new Date(start);
while (loop <= end) {
  console.log("english", datefns.format(loop, "yyyy-MM-dd"));
  console.log("nepali", bikram.ADToBS(datefns.format(loop, "yyyy-MM-dd")));
  console.log("-------------");

  var newDate = loop.setDate(loop.getDate() + 1);
  loop = new Date(newDate);
}

output:

english 2021-04-01
nepali 2077-12-20
-------------
english 2021-04-02
nepali 2077-12-21
-------------
english 2021-04-03
nepali 2077-12-22
-------------
english 2021-04-04
nepali 2077-12-23
-------------
english 2021-04-05
nepali 2077-12-24
-------------
english 2021-04-06
nepali 2077-12-25
-------------
english 2021-04-07
nepali 2077-12-26
-------------
english 2021-04-08
nepali 2077-12-27
-------------
english 2021-04-09
nepali 2077-12-28
-------------
english 2021-04-10
nepali 2077-12-29
-------------
english 2021-04-11
nepali 2077-12-30
-------------
english 2021-04-12
nepali 2077-12-31
-------------
english 2021-04-13
nepali 2077-01-01
-------------

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.