Comments (6)
Hi,
Thanks, this is a bug.
from ephemeris.
Hi,
below the "$ ns.julian.calc" changed that solves the bug of Julian date.
I hope.
Thanks a lot,
blu
$ns.julian.calc = function (date) {
var centuries;
var year;
var month;
var b = 0;
var c;
var e;
/* The origin should be chosen to be a century year
* that is also a leap year. We pick 4801 B.C.
*/
year = date.year + 4800;
if (date.year < 0) {
year += 1;
}
/* The following magic arithmetic calculates a sequence
* whose successive terms differ by the correct number of
* days per calendar month. It starts at 122 = March; January
* and February come after December.
*/
month = date.month;
if (month <= 2) {
month += 12;
year -= 1;
}
e = Math.floor ((306 * (month + 1)) / 10);
// number of centuries
centuries = Math.floor (year / 100);
if (date.year <= 1582) {
if (date.year == 1582) {
if (date.month < 10) {
b = -38;
}
if (date.month > 10 || date.day >= 15) {
// number of century years that are not leap years
b = Math.floor ((centuries / 4) - centuries);
}
}
else { b = -38; } //**** additional line to fix the bug *****
} else {
b = Math.floor ((centuries / 4) - centuries);
}
// Julian calendar years and leap years
c = Math.floor ((36525 * year) / 100);
/* Add up these terms, plus offset from J 0 to 1 Jan 4801 B.C.
* Also fudge for the 122 days from the month algorithm.
*/
date.julianDate = b + c + e + date.day - 32167.5;
// Add time
date.julianTime = (3600.0 * date.hours + 60.0 * date.minutes + date.seconds) / 86400.0;
date.julian = date.julianDate + date.julianTime;
date.j2000 = 2000.0 + (date.julian - $const.j2000) / 365.25;
date.b1950 = 1950.0 + (date.julian - $const.b1950) / 365.25;
date.j1900 = 1900.0 + (date.julian - $const.j1900) / 365.25;
return date.julian;
};
from ephemeris.
Sorry I had closed the bug by accident.
blu
from ephemeris.
Hi!
Could you make a pull request?
from ephemeris.
OK done.
from ephemeris.
Merged.
from ephemeris.
Related Issues (20)
- Compute separation angle of two objects (Sun, Moon) from location on Earth at time? HOT 2
- North and south moon nodes HOT 5
- Longitude speed HOT 1
- retrograde planets? HOT 2
- Stars data
- Best Practice for Importing/Exporting classes in Angular project
- How to find ascendant? HOT 2
- possible typo's in code.
- e.load() has to run 3 times for proper calculations to be made. HOT 2
- twilight
- Understanding PhaseQuarter of Moon calculation HOT 3
- Query on how to compute planetary angles HOT 2
- Converting to php
- Code for calculating "exact" sunrise/sunset
- Question
- Calculating Eclipses
- Here goes nothing... unconventional contact method, yes, but I REALLY want to discuss HD with you.
- Geocentric distance equal to -1?... HOT 6
- local Apparent Sidereal Time Incorrect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ephemeris.