Android Question AnotherDatePicker - dates before 1970

LucaMs

Expert
Licensed User
I have not watched the update yet but...

It seems enough to change that line:...
I think it is not enough, because:

B4X:
Private Sub GetCurrentDateFromTextField (DateString As String) As Long
    Try
        Dim ticks As Long = DateTime.DateParse(DateString)
        If DateTime.GetYear(ticks) >= minYear And DateTime.GetYear(ticks) <= maxYear Then
            Return ticks
        End If
    Catch
        'invalid date
    End Try 'ignore
    Return 0
End Sub

And zero is a valid number of ticks for a date (1/1/1970).

Maybe GetCurrentDateFromTextField should return an Object and so you can return a different value (Null) for an invalid date.
 
Upvote 0
Top