Private minyear As String = "2019"
'Date cannot be before jan 1, 2019
Sub Pref_IsValid (TempData As Map) As Boolean
Dim x As Long =DateTime.dateparse("1/1/" & minyear)
Dim d As Long = TempData.GetDefault("Date", DateTime.Now)
If d < x Then
prefdialog.ScrollToItemWithError("Date")
Return False
End If
Return True
End Sub
The B4XPreferenceDialog date is based on the B4XDateTemplate class located in the XUI Views library. It defaults to a minum year of 1970, but you can change it in your code by adding this line
B4X:
Private minyear As String
prefdialog.DateTemplate.MinYear =1950 'add this line so you can navigate beyond 1970
minyear ="1960"