webcore tdatetimepicker time is not working

Hi,

When using a twebdatetimepicker and setting the kind to dtkTime
user set the time correctly on the component but when you try to get the time value of the timepicker with dtepickerexample.datetime or dtepickerexample.time it gets a wrong time not the one set manually on the component on runtime.

Also when you tried to applied a time with code to the time picker, example: dtepickerexample.datetime := now or dtepickerexample.time := time it doesnt display correct time on the webtimepicker on runtime

Do you use TMS WEB Core v2.4.5.4 as I cannot reproduce an issue with the latest version.

image

Hi Bruno,

Upgraded to version 2.4.5.4, the problem persists. If you see the images assigned by code the time to datetimepicker but it doesnt show anything on the datetimepicker on runtime.

image

image

Here is more info about my system configuration:

Firefox 122.0.1 (64-bit)
Delphi 11.3
TMS web Core 2.4.5.4

Firefox language Spanish [es-do]

What is the value

TFormatSettings.Invariant.LongTimeFormat

in your browser?

Hi Bruno,

console.log(TFormatSettings.Invariant.LongTimeFormat):

HH:mm:ss

I cannot reproduce this and I cannot understand there is an issue with this format.
Do you have another browser to test?

When you add following code:

procedure TForm1.WebButton1Click(Sender: TObject);
var
  el: TJSHTMLElement;
begin
  el := WebDateTimePicker1.ElementHandle;
  asm
    console.log(el.children[1].value);
  end;
end;

what do you see in the browser console?

Firefox:

Chrome:

Doing more test:

Chrome language Spanish (without country):

Chrome language Spanish (with a country US)

I retested this here with Firefox too and I cannot see an issue.

What do you see in the browser console for this code:

procedure TForm1.WebButton2Click(Sender: TObject);
var
  el: TJSHTMLElement;
begin
  WebDateTimePicker1.Kind := dtkTime;
  WebDateTimePicker1.Time := Now;
  el := WebDateTimePicker1.ElementHandle;
  asm
    console.log(el.children[1].value);
  end;
end;

Hi Bruno,

You can replicate it on Firefox and Chrome, following this exact steps.

Step 1.
On your browser setting language set Spanish DO (ES-DO) with a country zone for the language.

Step 2.
When you compile and run the code that you sent me for the testing you will see the following screen:

image

Step 3.
After you press Button1 or in your case is button2, when you will see that the datetimepicker will go blank

Step 4.
Change again browser setting this time removing the country instead of having ES-DO (or any other country) to ES (without country)

image

Step 5.
After you press Button1 or in your case is button2, when you will see that the datetimepicker will then work

Conclusion: The problem happens when datetime picker is set to dktime and the browser language is other than english for example spanish and have added a country on the language setting, example ES-DO.

Hope this clarify more you the problem

Did you check
TFormatSettings.Invariant.LongTimeFormat
in all these scenarios?

We implemented a workaround for this.