04-02-2024 11:16 PM
All,
Does Anyone know how to localize date/time picker? I mean, the date/time format where the default is MM/dd/yyyy hh:mm:ss.fff and I want it to be in dd/MM/yyyy hh:mm:ss format.
I used javascript (see: link ) but it works only if I use date/time picker button, but not if I changed the date/time manually (changing the first item - supposed to be dd will jump to MM).
I saw the html code generated but unsure how to make the change permanent and worked for both using picker button as well as put the date/time manually:
:
:
<div class="ni-front-panel-wrapper" vi-ref="" ni-control-id="FrontPanelWrapper">
<ni-front-panel control-resize-mode='fixed' layout='absolute' ni-control-id='2'>
<jqx-date-time-picker binding-info='{"accessMode": "readOnly", "dataItem": "dataItem_Timestamp", "dco": 0, "isLatched": false, "prop": "value", "sync": false, "unplacedOrDisabled": true}' calendar-button='true' control-resize-mode='fixed' display-kind='local'
drop-down-display-mode='classic' edit-mode='partial' follower-ids='["4"]' format-string='MM/dd/yyyy hh:mm:ss.fff tt' label-alignment='top-left' label-id='4' max='DateTime('3000-12-31 17:00:00.000', 'UTC')' min='DateTime('1599-12-31 17:00:00.000', 'UTC')'
ni-control-id='3' spin-buttons='true' spin-buttons-initial-delay='500' spin-buttons-position='left' validation='interaction' value='DateTime('1904-01-01 00:00:00.000', 'UTC')'></jqx-date-time-picker>
:
:
04-03-2024 11:42 AM
@irfanabid wrote:
I used javascript (see: link ) but it works only if I use date/time picker button, but not if I changed the date/time manually (changing the first item - supposed to be dd will jump to MM).
I tried the linked example with the string you mentioned, dd/MM/yyyy hh:mm:ss, and the example seems to work both interactively with keyboard and from the date/time picker button. The first part of the string seems to be treated as the day:
Do you have an example that shows the unexpected behavior you have seen?
04-04-2024 02:06 AM
Hi Milan,
Please see the attached file.
I just realized that it's not in all PC. In another PC, it looks the same as you showed. Any idea why it can behave differently?
Using the correct behavior, however, I saw an issue if I enter invalid data, say month 13, or day 32.
04-04-2024 11:22 AM
I just realized that it's not in all PC. In another PC, it looks the same as you showed. Any idea why it can behave differently?
I'm not sure and I have not been able to reproduce the behavior so it would be difficult to think of a workaround. Maybe the systems have different locale settings?
It's probably an unsatisfactory response but that is part of the risk of leveraging features G Web has not exposed in the editor. They may be incomplete or not thoroughly tested and therefore were not yet exposed for general usage. You may want to consider leveraging a third party JS library with the JavaScript Library Interface for more control of the desired features of a custom datetime picker.
04-05-2024 01:25 AM
Thanks Milan.
We will try to investigate further why it can behave differently in that particular pc and look also into third party date/time picker.