G Web Development Software

cancel
Showing results for 
Search instead for 
Did you mean: 

Customize date/time picker in G-web

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(&apos;3000-12-31 17:00:00.000&apos;, &apos;UTC&apos;)' min='DateTime(&apos;1599-12-31 17:00:00.000&apos;, &apos;UTC&apos;)'
ni-control-id='3' spin-buttons='true' spin-buttons-initial-delay='500' spin-buttons-position='left' validation='interaction' value='DateTime(&apos;1904-01-01 00:00:00.000&apos;, &apos;UTC&apos;)'></jqx-date-time-picker>

:

:

Thanks & Regards,
Irfan
(CLD)
https://haliatech.com/
0 Kudos
Message 1 of 5
(800 Views)

@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:

 

datetime.gif

Do you have an example that shows the unexpected behavior you have seen?

 


Milan
0 Kudos
Message 2 of 5
(766 Views)

 

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.

Thanks & Regards,
Irfan
(CLD)
https://haliatech.com/
0 Kudos
Message 3 of 5
(735 Views)

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.


Milan
0 Kudos
Message 4 of 5
(714 Views)

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. 

Thanks & Regards,
Irfan
(CLD)
https://haliatech.com/
0 Kudos
Message 5 of 5
(703 Views)