diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index 32d0979db..2f3306545 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -285,7 +285,7 @@ class Satellite extends CI_Controller { $tle = new Predict_TLE($sat_tle->satellite, $temp[0], $temp[1]); // Instantiate it $sat = new Predict_Sat($tle); // Load up the satellite data - $now = Predict_Time::get_current_daynum(); // get the current time as Julian Date (daynum) + $now = $this->get_daynum_from_date($this->security->xss_clean($this->input->post('date'))); // get the current time as Julian Date (daynum) // You can modify some preferences in Predict(), the defaults are below // @@ -316,4 +316,17 @@ class Satellite extends CI_Controller { $data['format'] = $format; $this->load->view('satellite/passtable', $data); } + + public static function get_daynum_from_date($date) { + // Convert a Y-m-d date to a day number + + // Convert date to Unix timestamp + $timestamp = strtotime($date); + if ($timestamp === false) { + throw new Exception("Invalid date format. Expected Y-m-d."); + } + + // Calculate the day number + return Predict_Time::unix2daynum($timestamp, 0); + } } diff --git a/application/views/satellite/pass.php b/application/views/satellite/pass.php index 83d087e6b..0d84fdd3c 100644 --- a/application/views/satellite/pass.php +++ b/application/views/satellite/pass.php @@ -469,12 +469,10 @@ - + +