From: bruce on
On Apr 28, 7:21 pm, RobG <rg...(a)iinet.net.au> wrote:
> On Apr 28, 1:11 pm, bruce <bruc...(a)bellsouth.net> wrote:
>
> > The input for this this code is YearT=2010, MonthIndex=3, DayT = 27,
> > Start_HourT = 22, Start_MinutesT=15,
> > End_HourT = 20, End_MinutesT = 15
>
> By convention, variable names starting with a capital letter signify
> constructors or, where all characters are upper case, constants. Code
> is much easier to read if neatly indented and, when posted to a news
> group, manually wrapped at about 70 characters.
>
>
>
> > var InputStart = new Date();
> > var InputEnd = new Date();
>
> There's no point initialising variables with a value that you
> immediately overwrite.
>
> > InputStart = Date(YearT, MonthIndex, DayT, Start_HourT,Start_MinutesT,
> > 0,0);
> > InputEnd = Date(YearT, MonthIndex, DayT, End_HourT, End_MinutesT,0,0);
>
> Here you overwrite the intial values assigned to these variables,
> trivialising in the initial assignment. In ECMAScript, variables do
> not have a type (their values do), you can assign any type to any
> variable so there is no need to initialise them if you don't want to.
>
> > alert(Start_HourT + ":" + End_HourT); // output is 22:20 Correct
> > output
>
> > alert("==: " + (InputStart == InputEnd)); // Output is true?? Output
> > Not Correct
>
> Consider (wrapped for posting):
>
>   var yearT=2010,
>       monthIndex=3,
>       dayT = 27,
>       start_HourT = 22,
>       start_MinutesT=15,
>       end_HourT = 20,
>       end_MinutesT = 15,
>       inputStart = new Date(yearT, monthIndex, dayT,
>                             start_HourT, start_MinutesT, 0, 0),
>       inputEnd = Date(yearT, monthIndex, dayT, end_HourT,
>                       end_MinutesT, 0, 0);
>
>   alert(inputStart == inputEnd); // false
>
> --
> Rob

I "Solved" my compare problem by adding ".toString()" to both
InputStart and InputEnd;

Thanks for the help..

Bruce