logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • David Marsh
    • Posted on Sun 26 Nov 2000

    A couple of things to keep in mind when using the JavaScript validator.

    The first is to do with two digit and four digit years being returned by Domino.

    When using the @Adjust formula or Now() in LotusScript, if the regional settings on the servers OS that Domino is running indicate a short date style like this dd/MM/yy then obviously you get two digits for the year. It is recommended to change the settings to dd/MM/yyyy and restart the domino server.

    Something for developers to keep in mind.

    A small change to the validator script to simplify the use of javascript arrays and regular expressions is to make the following change to the DateComponents function in the global.js page.

    function DateComponents(dateStr, format) {

    var results = new Array();

    REPLACE THESE TWO LINES -------------------------------------------------------- var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; var matchArray = dateStr.match(datePat); -------------------------------------------------------- WITH THIS ONE -------------------------------------------- var matchArray = dateStr.split( /\/|-/ ) --------------------------------------------

    if (matchArray == null) { return null; }

    // parse date into variables if (format.charAt(0)=="d"){ //what format does the server use for dates? results[0] = matchArray[1]; results[1] = matchArray[3]; } else { results[1] = matchArray[1]; results[0] = matchArray[3]; } results[2] = matchArray[4]; return results; }

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: