new leadership draft being posted...

Eric S. Raymond esr at thyrsus.com
Wed Dec 3 20:02:50 UTC 2003


Michael K. Johnson <johnsonm at redhat.com>:
> On Mon, Dec 01, 2003 at 10:29:38PM +0100, Xose Vazquez Perez wrote:
> > would you mind to place the date of the latest modification
> > on bottom of all the web pages ?
> > 
> > Now, it's nearly impossible to know when somebody modify a page.
> 
> I'll get it started.  There are a few pages in sufficient flux that I
> might miss adding the $Date$ strings in, but I think that once you see
> "This page last modified at:" on the web site, you can be reasonably
> sure that pages that don't show that text at the bottom haven't been
> recently modified.

There's a easier way.  I use this Javascript fragment in my headers:

<script language="JavaScript" src="/~esr/datestamp.js">

Here's the JavaScript to go with it:

---------------------------------------------------------------------------
// JavaScript to generate a compact date representation

//
// format date as dd-mmm-yy
// example: 12-Jan-99
//
function date_ddmmmyy(date)
{
  var d = date.getDate();
  var m = date.getMonth() + 1;
  var y = date.getYear();

  // handle different year values 
  // returned by IE and NS in 
  // the year 2000.
  if(y >= 2000)
  {
    y -= 2000;
  }
  if(y >= 100)
  {
    y -= 100;
  }

  // could use splitString() here 
  // but the following method is 
  // more compatible
  var mmm = 
    ( 1==m)?'Jan':( 2==m)?'Feb':(3==m)?'Mar':
    ( 4==m)?'Apr':( 5==m)?'May':(6==m)?'Jun':
    ( 7==m)?'Jul':( 8==m)?'Aug':(9==m)?'Sep':
    (10==m)?'Oct':(11==m)?'Nov':'Dec';

  return "" +
    (d<10?"0"+d:d) + " " +
    mmm + " " +
    (y<10?"0"+y:y);
}


//
// get last modified date of the 
// current document.
//
function date_lastmodified()
{
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;

  // check if we have a valid date
  // before proceeding
  if(0 != (d1=Date.parse(lmd)))
  {
    s = "" + date_ddmmmyy(new Date(d1));
  }

  return s;
}

//
// finally display the last modified date
// as DD-MMM-YY
//
document.writeln( 
  date_lastmodified() );

// End
---------------------------------------------------------------------------
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>





More information about the fedora-devel-list mailing list