Javascript issue with TimeZone offset

I am having issues with this javascript code, it is supposed to provide DST (daylight saving time) offset but for some reason it is giving wrong numbers:

I am in Chile. In here, until year 2014 we had the following DST:
In Winter we have GMT -3 (May, Jun, Jul and August)
In Summer we have GMT -4 (Sep, Oct, Nov, Dec, Jan, Feb and March)

<!DOCTYPE html>
<html>
    <head>
    <title>DST JRPC</title>
    <script type="text/javascript">

    

    function FindDstSwitchDate()
 {

			var ene = new Date(2013,01,01,12,10,14).getTimezoneOffset()/60;
			var feb = new Date(2013,02,01,12,10,14).getTimezoneOffset()/60;
			var mar = new Date(2013,03,01,12,10,14).getTimezoneOffset()/60;
			var abr = new Date(2013,04,01,12,10,14).getTimezoneOffset()/60;
			var may = new Date(2013,05,01,12,10,14).getTimezoneOffset()/60;
			var jun = new Date(2013,06,01,12,10,14).getTimezoneOffset()/60;
			var jul = new Date(2013,07,01,12,10,14).getTimezoneOffset()/60;
			var ago = new Date(2013,08,01,12,10,14).getTimezoneOffset()/60;
			var sep = new Date(2013,09,01,12,10,14).getTimezoneOffset()/60;
			var oct = new Date(2013,10,01,12,10,14).getTimezoneOffset()/60;
			var nov = new Date(2013,11,01,12,10,14).getTimezoneOffset()/60;
			var dic = new Date(2013,12,01,12,10,14).getTimezoneOffset()/60;
			

		return " Jan " + ene + 
		"<br> Feb " + feb + 
		"<br> Mar " + mar +
		"<br> Apr " + abr + 
		"<br> May " + may + 
		"<br> Jun " + jun + 
		"<br> Jul " + jul + 
		"<br> Aug " + ago + 
		"<br> Sep " + sep + 
		"<br> Oct " + oct + 
		"<br> Nov " + nov + 
		"<br> Dec " + dic;

    }

    </script>
    </head>
    <body>
        <script type="text/javascript">
            document.write("Current date/time: " + new Date() + "<br />");
            document.write(FindDstSwitchDate());
        </script>
    </body>
</html>

Open in new window

LVL 2
José PerezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skijCommented:
Does your code work for current and future dates but not dates before 2014?
0
José PerezAuthor Commented:
Since 2014 DST was fixed to GMT -3... but I fixed anyway, here is the solution:

<!DOCTYPE html>
<html>
    <head>
    <title>DST</title>
    <script type="text/javascript">

    function getTimeZone()
    {
		var ene = new Date(2013,01,01,12,10,14,00).getTimezoneOffset()/60;
		var feb = new Date(2013,02,01,12,10,14,00).getTimezoneOffset()/60;
		var mar = new Date(2013,03,01,12,10,14,00).getTimezoneOffset()/60;
		var abr = new Date(2013,04,01,12,10,14,00).getTimezoneOffset()/60;
		var may = new Date(2013,05,01,12,10,14,00).getTimezoneOffset()/60;
		var jun = new Date(2013,06,01,12,10,14,00).getTimezoneOffset()/60;
		var jul = new Date(2013,07,01,12,10,14,00).getTimezoneOffset()/60;
		var ago = new Date(2013,08,01,12,10,14,00).getTimezoneOffset()/60;
		var sep = new Date(2013,09,01,12,10,14,00).getTimezoneOffset()/60;
		var oct = new Date(2013,10,01,12,10,14,00).getTimezoneOffset()/60;
		var nov = new Date(2013,11,01,12,10,14,00).getTimezoneOffset()/60;
		var dic = new Date(2013,12,01,12,10,14,00).getTimezoneOffset()/60;

		return "<br>V Ene " + ene + 
		"<br>V Feb " + feb + 
		"<br>V Mar " + mar +
		"<br>" +
		"<br>I Abr " + abr + 
		"<br>I May " + may + 
		"<br>I Jun " + jun + 
		"<br>I Jul " + jul + 
		"<br>I Ago " + ago + 
		"<br>I Sep " + sep + 
		"<br>" +
		"<br>V Oct " + oct + 
		"<br>V Nov " + nov + 
		"<br>V Dic " + dic;
	}
    </script>
    </head>
    <body>
        <script type="text/javascript">
            document.write("Current date/time: " + new Date() + "<br />");
            document.write(getTimeZone());
        </script>
    </body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
José PerezAuthor Commented:
Fixed myself, it was a minor issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.