Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31999

Re: What is wrong with this If Else construction?

Newsgroups comp.lang.javascript
Subject Re: What is wrong with this If Else construction?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References (4 earlier) <e4aac875-685d-4fe8-a06c-132f8f961b68@googlegroups.com> <58615438$0$21427$e4fe514c@news.xs4all.nl> <f7217774-4e2d-49e6-b03b-a21aec7980b1@googlegroups.com> <XnsA6EB66B6EE392eejj99@194.109.6.166> <505046fc-12c8-4dcc-8ae6-c3caf7470b1a@googlegroups.com>
Date 2016-12-27 21:46 +0100
Message-ID <XnsA6EBDD7D05C4Aeejj99@194.109.6.166> (permalink)

Show all headers | View raw


Bart Smissaert <bart.smissaert@gmail.com> wrote on 27 Dec 2016 in
comp.lang.javascript: 

> On Tuesday, 27 December 2016 09:05:53 UTC, Evertjan.  wrote:
>> Bart Smissaert <bart.smissaert@gmail.com> wrote on 27 Dec 2016 in
>> comp.lang.javascript: 
>> 
>> > Look at the JS code I posted, 
>> 
>> Where? What?
>> 
>> > especially the comments and you may figure
>> > out what is going on. 
>> 
>> Are you responding to someone?
>> 
> 
>> Please always quote relevant parts.
>> 
>> Please quote, 
>> this is not email, not GG,
>> this is Usenet.

[Please do not quote signatures on usenet. Removed]
 
> Look at the beginning of the last mail I posted with JS code:
> 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> function JS_GetAge5(lDOB) 
> 
>     //Change constant functions to literals 
>     //----------------------------------------- 
> 
> 
> { 
> 
>     var jDOB = new Date((lDOB - (25569)) * 86400 * 1000); 
>     //return jDOB; 
> 
>     jDOBYear = jDOB.getFullYear(); 
>     //return jDOBYear; 
> 
> 
>     jDOBMonth = jDOB.getMonth() + 1; //as getMonth is 0-based! 
> 
>     //return jDOBMonth; 
> 
>     var todayDate = new Date(); 
> 
>     todayYear = todayDate.getFullYear(); 
>     //return todayYear; 
> 
> 
>     todayMonth = todayDate.getMonth(); //no + 1 here as this will be
>     replaced by VB6 to a literal! 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> Maybe now you understand.

This was not a Q about understanding, 
but about you not quoting and adressing an unknown "you".


> If not then change this line:
> 
> jDOBMonth = jDOB.getMonth() + 1;
> 
> to this:
> 
> jDOBMonth = jDOB.getMonth();
> 
> and test again.

No, 
I will not test anything,
you should test and demonstrate what debugging your errors shows.

=============

Methinks the most efficient way of determining an age 
against the present day is
[I am not going into Excel quircks here]
in pseudocode[!!]:

age = presentYear - birthYear;
if (setFullYear(birthYear,birthMonth-1,birthDate) < 
  setFullYear(birthYear,presentMonth-1,presentDate))
     age--;

[setFullYear will correct for non-leapyears]

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What is wrong with this If Else construction? bart.smissaert@gmail.com - 2016-12-26 00:05 -0800
  Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-26 10:37 +0100
    Re: What is wrong with this If Else construction? bart.smissaert@gmail.com - 2016-12-26 03:45 -0800
      Re: What is wrong with this If Else construction? Luuk <luuk@invalid.lan> - 2016-12-26 12:59 +0100
        Re: What is wrong with this If Else construction? bart.smissaert@gmail.com - 2016-12-26 04:02 -0800
          Re: What is wrong with this If Else construction? bart.smissaert@gmail.com - 2016-12-26 04:16 -0800
      Re: What is wrong with this If Else construction? me <mu@local.local> - 2016-12-26 13:34 +0100
        Re: What is wrong with this If Else construction? Bart Smissaert <bart.smissaert@gmail.com> - 2016-12-26 05:02 -0800
          Re: What is wrong with this If Else construction? Luuk <luuk@invalid.lan> - 2016-12-26 18:32 +0100
            Re: What is wrong with this If Else construction? Bart Smissaert <bart.smissaert@gmail.com> - 2016-12-26 15:32 -0800
              Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-27 10:05 +0100
                Re: What is wrong with this If Else construction? Bart Smissaert <bart.smissaert@gmail.com> - 2016-12-27 03:27 -0800
                Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-27 21:46 +0100
                Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-29 18:36 +0100
                Re: What is wrong with this If Else construction? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-12-28 23:16 +0000
              Re: What is wrong with this If Else construction? Luuk <luuk@invalid.lan> - 2016-12-27 22:28 +0100
                Re: What is wrong with this If Else construction? Gene Wirchenko <genew@telus.net> - 2016-12-27 15:07 -0800
                Re: What is wrong with this If Else construction? Luuk <luuk@invalid.lan> - 2016-12-28 19:37 +0100
      Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-26 21:56 +0100
        Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-26 22:14 +0100
          Re: What is wrong with this If Else construction? Gene Wirchenko <genew@telus.net> - 2016-12-26 14:12 -0800
            Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-27 00:02 +0100
            Re: What is wrong with this If Else construction? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-12-27 22:36 +0000
              Re: What is wrong with this If Else construction? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-28 10:36 +0100
  Re: What is wrong with this If Else construction? Luuk <luuk@invalid.lan> - 2016-12-26 17:00 +0100
    OT: Leap year bug in Excel (was: What is wrong with this If Else construction?) "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-26 17:12 +0100
  Re: What is wrong with this If Else construction? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-12-27 22:52 +0000
    Re: What is wrong with this If Else construction? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-28 01:01 +0100
      Re: What is wrong with this If Else construction? $Bill <news@todbe.com> - 2016-12-27 22:19 -0800
        Re: What is wrong with this If Else construction? Tim Streater <timstreater@greenbee.net> - 2016-12-28 10:05 +0000
          Re: What is wrong with this If Else construction? [OT] $Bill <news@todbe.com> - 2016-12-28 13:59 -0800
            Re: What is wrong with this If Else construction? [OT] Tim Streater <timstreater@greenbee.net> - 2016-12-28 22:17 +0000

csiph-web