Jump to content

Recommended Posts

Posted

Hi!

 

I m using tUnidbDateTimePicker with Kind = tUnitime and usesystemformat = true;

I have Us TimeZone so DateTimePicker must display AM/PM from 0:00:00 to 12:00

But i have :

 

 

image.png.56cad113b45e3ec269cea8bfd12c0a50.png

 

 

Br,Alessandro

 

 

Posted

Yes, it looks like the issue was in the DelphiTimeFormatToPickerFormat method (inside uniGUIJSUtils.pas).

This fix is for testing only — we’ll review and apply it properly in future builds.

uses ... System.RegularExpressions;

function DelphiTimeFormatToPickerFormat(DFormat: string): string;
var
  S: string;
begin
  // Delphi short/Long time formats uses "m" for minutes while the rest of formatting system uses "n" for minutes
  //  Result := StringReplace(DFormat, 'm', 'n' , [rfReplaceAll]);
  //  Result := DelphiToPickerFormat(Result);
  
  // === fixed ===
  if DFormat = '' then
    Exit('');

  S := DFormat;
  S := TRegEx.Replace(S, '(?i)\b(am/pm|ampm|tt|am|pm)\b', #2'AMPM'#3);
  S := StringReplace(S, 'm', 'n', [rfReplaceAll]);
  S := DelphiToPickerFormat(S);
  S := StringReplace(S, #2'AMPM'#3, 'A', [rfReplaceAll]);

  Result := S;
end;

 

Posted

Hi!

 

If i use Hh:mm tt in timezone and It works. But in text on datetinepicker It display 02:01 Am:001:0

In my db i have field ttime in this format:

01:00:00 so It doesn t display It correctly.

Br,Alessandro

Posted
1 hour ago, Alr1976 said:

Us Format

Do you mean that you want to change the display format to the US date and time format (MM/DD/YYYY and 12-hour clock with AM/PM)?

Posted

Hi ,

In my unifrane i have a tunidbdatepicker. I use only time .

In time format i use 'hh:mm tt'. In this way i see when i  select tunidbdatepicker correctly items:

12 am

11 am

10 am

Etc.

In my Mariadb my ttime Is:

22:00

 

When i open my form, First time show( in text property)

10:00 pm:001:01. If i choose item It show me correctly:

 

10:00 pm.

 

So First time in tunidbdatepicker show me wrong format.

 

Tks,Alessandro

 

Posted
21 hours ago, Alr1976 said:

date.rar 1.81 MB · 1 download

Hello,

Use this approach for now:

1. image.png.fd88e808860e593e3d0e8af8fb1e9aee.png

2. ClientEvents.UniEvents ->

function beforeInit(sender, config) 
{
    config.format = 'h:i A';
    config.listeners = {
        afterrender: function(picker) {
            if (picker.initialValue) picker.setValue(picker.initialValue);
        }
    };
}

image.png.396fdae239b1f1049fdda784b490330e.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...