Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Custom JavaScript Calendar

    Hi,
    I want to build a custom calendar using javascript.
    On load of page for which date schedule are there, it should show dark black dot at left-top corner of particular date for current month.
    There are 3 button below the calendar as prev mnth,create schedule,next mnth.
    when prev is clicked it should works same as on load for previous month, similarly for next mnth.

    Pls help its urgent.

    Thanks
    Last edited by chandanp; 03-27-2012 at 01:52 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,302
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    This forum is not a free coding service nor an arm of social security. There are very many excellent scripts for calendars out there.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    I had some trouble with Easter, and got some help with the math,
    so I'll give you a hand there:
    Code:
    Date.getEaster= function(y){
    	var D= y? new Date(y, 1): new Date();
    	y= D.getFullYear();
    	if(y> 1583){
    		var X= Math.floor, a= y%19, b= X(y/100), c= y%100,
    		d= X(b/4), e= b%4, f= X((b+8)/25), g= X((b-f+1)/3),
    		h= (19*a+b-d-g+15)%30, i= X(c/4), k= c%4,
    		l= (32 + 2*e + 2*i - h - k)%7,
    		m= X((a + 11*h + 22*l)/451),
    		n= X((h + l - 7*m + 114)/31),
    		p= (h + l - 7*m + 114)%31;
    		D.setMonth(n-1, p+1);
    		if(D.getDay()=== 0) return D;
    	}
    	return false;
    };

    Code:
    // (non standard methods to display a range of dates-  
    //you can use a for loop and localeDateString)
    Array.range(1990, 2020).map(function(itm){
    	return Date.getEaster(itm).dayString('yb')
    }).join('\n');
    /* returned values:
    15 April, 1990
    31 March, 1991
    19 April, 1992
    11 April, 1993
    3 April, 1994
    16 April, 1995
    7 April, 1996
    30 March, 1997
    12 April, 1998
    4 April, 1999
    23 April, 2000
    15 April, 2001
    31 March, 2002
    20 April, 2003
    11 April, 2004
    27 March, 2005
    16 April, 2006
    8 April, 2007
    23 March, 2008
    12 April, 2009
    4 April, 2010
    24 April, 2011
    8 April, 2012
    31 March, 2013
    20 April, 2014
    5 April, 2015
    27 March, 2016
    16 April, 2017
    1 April, 2018
    21 April, 2019
    12 April, 2020
    */
    Last edited by mrhoo; 03-27-2012 at 05:26 PM. Reason: format


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •