"sunrise" and "sunset" will have a option HH:MM #148

Subhojit1992 opened this Issue Aug 18, 2015 · 5 comments


None yet

5 participants


First of all your pluging is awesome. :)
I had working on a project that require "sunrise" had to show 06:00 and "sunset" had to show 17:20.
But your plugin default option is "Sunrise 6:30 am / Sunset 5:27 pm".

I wonder if you modified your js file and put a optional method like

weather.alt.sunrise // Sunrise will be show 6:30
weather.alt.sunset // Sunset will be show 17:20

This will be a great feature for user.

Many thanks,


Thanks for checking out simpleWeather and for the feedback! Let me look into the best ways to do that. Yahoo doesn't return alt stuff as I do those calculations in the script. I've avoid touching any dates or times because even basic datetime stuff in JavaScript can add more complexity and lines of code then I've wanted for simpleWeather to have. I'll see what I can do or at the very least do a demo showing changing sunrise/sunset time to 24 vs 12 hour.


Yeah I know you had add those alt elements. I had checked your plugging code. Try once to changing sunrise/sunset time to 24 vs 12 hour. That little thing will added more flavor in the plugin. If I will have any idea I will sure share with you.

I love open source and js. You now I am Jr in this filed but I always have craze to contribute on open source. You can check my profile.

Your plugin is supper cool make it more cooler (y)

Khano commented Nov 3, 2015

I hope this will help you.

var astro_splitted = weather.sunrise.split(/\:|\s/,3); // splitting by : and spacebar between minutes and am/pm You can replace sunrise with sunset
alert(weather.astronomy.sunrise) // sunrise or sunset
alert(astro_splitted[0]) // hours;
alert(astro_splitted[1]) // minutes;
alert(astro_splitted[2]) // am/pm;
if (astro_splitted[2] == "pm" && astro_splitted[0] < 12) astro_splitted[0] = parseInt(astro_splitted[0]) + 12;
if (astro_splitted[2] == "am" && astro_splitted[0] == 12) astro_splitted[0] = parseInt(astro_splitted[0]) - 12;
if (astro_splitted[0]< 10) astro_splitted[0] = '0' + astro_splitted[0];
@fleeting fleeting added the Feature label Jan 29, 2016
@fleeting fleeting added this to the v4.0.0 milestone Jan 29, 2016
@fleeting fleeting self-assigned this Jan 29, 2016

I downloaded yesterday and my sunrise is showing only a single digit minute.

7:9 am instead of 7:09


@YoYo-Pete :

Using the example above, you can change:

if (astro_splitted[0]< 10) astro_splitted[0] = '0' + astro_splitted[0];

if (astro_splitted[0]< 10) astro_splitted[0] = '0' + astro_splitted[0]; // padd hours with 0 if (astro_splitted[1]< 10) astro_splitted[1] = '0' + astro_splitted[1]; // padd minutes with 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment