Jan 12, 2021, 6:25 AM
Time Picker Zone
Hello,
I'm using "TimeField" as per below window, the system/server time zone is GMT+3 but the posted time comes in different time zone.
Consider this scenario:
1. I try to add information and I input the followings:
Open Date: 13-Jan-2021
Open Time: 08:00:00
Close Date: 13-Jan-2021
Close Time: 09:00:00
Look for screenshot:
2. After adding, the time posted to adding function is as following:
HTML Code:
I'm using "TimeField" as per below window, the system/server time zone is GMT+3 but the posted time comes in different time zone.
Consider this scenario:
1. I try to add information and I input the followings:
Open Date: 13-Jan-2021
Open Time: 08:00:00
Close Date: 13-Jan-2021
Close Time: 09:00:00
Look for screenshot:
2. After adding, the time posted to adding function is as following:
HTML Code:
<ext:Window
ID="AddBidInfoWindow"
runat="server"
Icon="Box"
Hidden="true"
Closable="true"
Title="Add new bid"
AutoScroll="true"
Scroll="Both"
Width="600"
Height="460"
PaddingSpec="0 0 0 0"
MarginSpec="0 0 0 0"
ClientIDMode="Static"
Resizable="true"
BodyStyle="background-color:#fff;"
BodyPadding="5"
Layout="Form">
<Listeners>
<Show Handler="positionWindow(this);"/>
</Listeners>
<Items>
<ext:FormPanel
runat="server"
ID="AddBidInfoWindowPnl"
PaddingSpec="0 0 0 0"
MarginSpec="0 0 0 0"
MaxWidth="550"
MaxHeight="380"
Hidden="false"
Header="false"
ClientIDMode="Static"
Layout="FormLayout"
ButtonAlign="Right"
Frame="false" >
<Items>
<ext:TextField
runat="server"
AllowBlank="false"
ClientIDMode="Static"
ID="txtTitle"
FieldLabel="Title"
BlankText="Title is Required"
LabelAlign="Right" >
</ext:TextField>
<ext:TextArea
runat="server"
AllowBlank="false"
ClientIDMode="Static"
ID="txtDescription"
FieldLabel="Description"
BlankText="Description is Required"
LabelAlign="Right" >
</ext:TextArea>
<ext:DateField
ID="OpenDate"
MinWidth="110"
ReadOnly="false"
FieldLabel="Open Date"
runat="server"
ClientIDMode="Static"
Format="dd-MM-yyyy"
BlankText="Open Date is Required"
AllowBlank="false"
EnableKeyEvents="true">
</ext:DateField>
<ext:TimeField
ID="OpenTime"
MinWidth="110"
FieldLabel="Open Time"
ReadOnly="false"
runat="server"
ClientIDMode="Static"
Increment="30"
Format="HH:mm:ss"
BlankText="Open Time is Required"
AllowBlank="false"
EnableKeyEvents="true">
</ext:TimeField>
<ext:DateField
ID="CloseDate"
MinWidth="110"
FieldLabel="Close Date"
ReadOnly="false"
runat="server"
ClientIDMode="Static"
Format="dd-MM-yyyy"
BlankText="Close Date is Required"
AllowBlank="false"
EnableKeyEvents="true">
</ext:DateField>
<ext:TimeField
ID="CloseTime"
MinWidth="110"
ReadOnly="false"
FieldLabel="Close Time"
runat="server"
ClientIDMode="Static"
Increment="30"
Format="HH:mm:ss"
BlankText="Close Time is Required"
AllowBlank="false"
EnableKeyEvents="true">
</ext:TimeField>
</Items>
<Buttons>
<ext:Button runat="server" Icon="Key" Text="Add" >
<DirectEvents>
<Click OnEvent="addNewBidInfo" IsUpload="true" Before="if (#{AddBidInfoWindowPnl}.getForm().isValid()) {return true;} else {return false;}">
<EventMask ShowMask="true" Msg="Adding..." Target="CustomTarget" CustomTarget="={#{AddBidInfoWindowPnl}.body}" />
<ExtraParams>
<ext:Parameter
Name="mytxtTitle"
Value="#{txtTitle}.getValue()"
Mode="Raw"
Encode="false" />
<ext:Parameter
Name="mytxtDescription"
Value="#{txtDescription}.getValue()"
Mode="Raw"
Encode="false" />
<ext:Parameter
Name="myOpenDate"
Value="#{OpenDate}.getValue()"
Mode="Raw"
Encode="false" />
<ext:Parameter
Name="myOpenTime"
Value="#{OpenTime}.getValue()"
Mode="Raw"
Encode="false" />
<ext:Parameter
Name="myCloseDate"
Value="#{CloseDate}.getValue()"
Mode="Raw"
Encode="false" />
<ext:Parameter
Name="myCloseTime"
Value="#{CloseTime}.getValue()"
Mode="Raw"
Encode="false" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
<ext:Button runat="server" Icon="Decline" Text="Cancel" >
<Listeners>
<Click Fn="closeAddBidInfoWindow" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
VB Code: <DirectMethod>
Function addNewBidInfo(sender As Object, e As DirectEventArgs) As Boolean
Dim Title As String = e.ExtraParams("mytxtTitle").Trim
Dim Description As String = e.ExtraParams("mytxtDescription").Trim
Dim MyDateParts1() As String = e.ExtraParams("myOpenDate").ToString.Trim.Split("T")
Dim OpenDate As String = DateTime.Parse(MyDateParts1(0)).AddDays(1).ToString("dd-MMM-yyyy")
Dim MyTimeParts1() As String = e.ExtraParams("myOpenTime").ToString.Trim.Split("T")
Dim OpenTime As String = DateTime.Parse(MyTimeParts1(1)).ToString("HH:mm:ss")
Dim MyDateParts2() As String = e.ExtraParams("myCloseDate").ToString.Trim.Split("T")
Dim CloseDate As String = DateTime.Parse(MyDateParts2(0)).AddDays(1).ToString("dd-MMM-yyyy")
Dim MyTimeParts2() As String = e.ExtraParams("myCloseTime").ToString.Trim.Split("T")
Dim CloseTime As String = DateTime.Parse(MyTimeParts2(1)).ToString("HH:mm:ss")
Dim ValidationMSG As String = ""
If Title.Trim = "" Then
ValidationMSG &= "<br/>- Title is Required"
End If
If Description.Trim = "" Then
ValidationMSG &= "<br/>- Description is Required"
End If
If OpenDate.Trim = "" Then
ValidationMSG &= "<br/>- Open Date is Required"
End If
If OpenTime.Trim = "" Then
ValidationMSG &= "<br/>- Open Time is Required"
End If
If CloseDate.Trim = "" Then
ValidationMSG &= "<br/>- Close Date is Required"
End If
If CloseTime.Trim = "" Then
ValidationMSG &= "<br/>- Close Time is Required"
End If
If ValidationMSG <> "" Then
Ext.Net.X.Msg.Alert("Errors", ValidationMSG).Show()
Return False
Else
Dim CreationDate As String = clsGeneral.getCreationDate()
Dim CreationTime As String = clsGeneral.getCreationTime()
Dim strSQL As String = clsSQL.insertBidInfo(Title, Description, OpenDate,
OpenTime, CloseDate, CloseTime,
"1", CreationDate, CreationTime)
Dim suc As Integer = clsDB.ExecuteSQL(strSQL)
If suc > -1 Then
Ext.Net.X.Msg.Alert("Done", "Bid infomation has been added successfully").Show()
clsLog.logUserActions("Bid infomation has been added successfully [" & Title.Replace("'", "''").Trim & "]")
' Close popup
AddBidInfoWindow.Close()
clearAllFeilds()
loadBidList()
Return True
Else
clsLog.logErrors("addNewBidInfo: SQL Error: " & strSQL)
Ext.Net.X.Msg.Alert("Error", "Error occurred while adding information, please contact admin").Show()
Return False
End If
End If
Return True
End Function
Kindly, advice.