logo To Foot
© J R Stockton, ≥ 2012-04-17

JavaScript Calendars and Clocks.

Links within this site :-

See "About This JavaScript Site" in JavaScript Index and Introduction.

See "General Date/Time Introduction" in JavaScript Date and Time Introduction.

Calendars

See also in JavaScript Date and Time 6 : Date / Time Choosers and VBScript Date and Time 2 ff.

Passive

This civil month (to show suffixes), with today's date in red italics :-

Active

The JavaScript behind the following is moderately tested. Input dates are not validated; but all conversions are via Chronological Modified Julian Date, so all results are valid dates. MJD is, of course, GMT-based; CMJD is as MJD but for the local day. For more limited purposes, it would be easy to simplify to use the usual JavaScript base date. Current calendar rules are assumed. All three- and four- digit years should be reliable. Do not insert ridiculous or malformed numbers (there is partial protection).

Small Functions

Writing into Controls

Range is now A.D. 0001 to 9999 inclusive.

Gregorian Date Converter
C.M.J.D.  (day) ISO 8601 Date ISO Year, Day ISO Week, Day
() - - - -W -
   
   
Expects fixed pitch font, with spaces

Select a new date (some browsers)
       Gregorian     Easter Sunday
UK/EU Summer Time : March to October @ 01:00 GMT (EU rules)
Summer Time according to your system :-
 on   off 
+     alter clock after seeing     -
Enter numbers for CMJD or YYYY MM DD or YYYY DDD or YYYY NN D
or UNIX time_t, and press the corresponding "Apply" button; or press "Today".

Week Numbers are as ISO 8601.

Writing into Page with Wryt

Press "V" to open a text calendar, etc., here,
initially using the month selected above.

Feasts & Fasts and Holidays

Determination of the other Moveable Feasts & Fasts of the Church of England is now trivial; they are almost all at constant offsets from Easter Sunday. For secular holidays, also see Annual Holiday Dates. For Jewish days, see in The Hebrew Calendar.

Clocks

If your clock settings are correct -
Static Clock


Running Clock


  Clock  

Repeated use of setTimeout(<command>, 1000) may give average intervals of over one second, because of execution time and timer resolution. To reliably lock to the second, calculate the delay needed each time, as here and in JavaScript Date and Time 0 : Date Object Information.

Coding

Reference to the JavaScript date functions could be removed entirely (except for determining "Now" and "Today"), by replacing them with more predictable and controllable code derived from my dateprox.pas; however, if used correctly, the JavaScript Date object is powerful. On the other hand, some parts use (for compatibility with previous Pascal work) CMJD for the day count; and, if used in isolation, could be converted to rely more on Date objects. And Wryt has replaced DynWrite.

See in and via Date and Day Count, The Date of Easter Sunday, and JavaScript Include Files.

For JavaScript Date Bugs, now see in JavaScript Date and Time Troubles.

Home Page
Mail: no HTML
© Dr J R Stockton, near London, UK.
All Rights Reserved.
These pages are tested mainly with Firefox and W3's Tidy.
This site, , is maintained by me.
Head.