jj date fix

This commit is contained in:
Jonathan Jenne 2017-09-19 16:46:00 +02:00
parent 0e5a48f92c
commit 2a12d034da
2 changed files with 25 additions and 21 deletions

View File

@ -5,6 +5,7 @@ Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraEditors.Controls
Public Class ClassWindreamDocGrid
Public Shared SELECTED_DOC_PATH As String
@ -298,8 +299,6 @@ Public Class ClassWindreamDocGrid
Next
End Sub
Public Shared Sub detailView_CustomRowCellEdit(grvw As GridView, e As CustomRowCellEditEventArgs)
Try
If (e.Column.Name = "colVALUE") Then
@ -332,30 +331,29 @@ Public Class ClassWindreamDocGrid
If typeId = 4 Then
Dim dateedit As New RepositoryItemDateEdit()
' Brauchen wir Zeitangaben in den Custom Fields?
AddHandler dateedit.CustomDisplayText, Sub(sender As Object, _e As DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs)
dateedit.DisplayFormat.FormatType = FormatType.DateTime
dateedit.DisplayFormat.FormatString = CURRENT_DATE_FORMAT
dateedit.EditFormat.FormatType = FormatType.DateTime
dateedit.EditFormat.FormatString = CURRENT_DATE_FORMAT
dateedit.EditMask = CURRENT_DATE_FORMAT
AddHandler dateedit.FormatEditValue, Sub(sender As Object, _e As ConvertEditValueEventArgs)
_e.Handled = True
End Sub
AddHandler dateedit.CustomDisplayText, Sub(sender As Object, _e As Controls.CustomDisplayTextEventArgs)
Dim parsedDate As DateTime
If Not DateTime.TryParse(_e.Value, parsedDate) Then
Try
If _e.Value <> "" Then
parsedDate = DateTime.ParseExact(_e.Value, CURRENT_DATE_FORMAT, System.Globalization.DateTimeFormatInfo.InvariantInfo) '& " HH:MM:ss"
_e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT) '& " HH:MM:ss")
End If
Catch ex As Exception
If LogErrorsOnly = False Then ClassLogger.Add("Error in parse-Date: " & ex.Message, False)
End Try
Dim stringDate As String = _e.Value.ToString
If stringDate.Trim() = String.Empty Then
_e.DisplayText = ""
Else
If Not DateTime.TryParse(stringDate, parsedDate) Then
parsedDate = DateTime.ParseExact(stringDate, CURRENT_DATE_FORMAT, Globalization.DateTimeFormatInfo.InvariantInfo)
End If
_e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT)
End If
End Sub
AddHandler dateedit.EditValueChanged, _datepickerValueChangedHandler
e.RepositoryItem = dateedit
End If

View File

@ -3698,7 +3698,13 @@ Public Class frmConstructor_Main
Dim value As DateTime = DatePicker.EditValue
Dim oldValue As Date
Dim validDate As Boolean = Date.TryParse(DatePicker.OldEditValue, oldValue)
Dim validDate As Boolean = False
Try
validDate = Date.TryParse(DatePicker.OldEditValue, oldValue)
Catch ex As Exception
oldValue = Date.MinValue
End Try
If Not validDate Then
oldValue = Date.MinValue