I have a trouble using the date range in MonthCal and DateTime.
I think it may be a bug? but i'm not sure what it really is.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance
#Warn All
; v2
MinDate := SubStr(DateAdd(A_YYYY A_MM A_DD, -1, "D"), 1, 8)
MaxDate := SubStr(DateAdd(A_YYYY A_MM A_DD, 1, "D"), 1, 8)
MyGui := Gui()
; can't restrict minimum date.
MyGui.AddMonthCal("Range" MinDate "-" MaxDate)
MyGui.AddDateTime("wp 1 Range" MinDate "-" MaxDate)
; "Invalid option" error occurred. but documents say that the minimum or maximum may be omitted.
;MyGui.AddMonthCal("Range" MinDate "-")
;MyGui.AddDateTime("wp 1 Range" MinDate "-")
MyGui.OnEvent("Close", (*) => ExitApp())
MyGui.Show()
; v1 code. this works in v1.
;MinDate := MaxDate := A_YYYY A_MM A_DD
;MinDate += -1, D
;MinDate := SubStr(MinDate, 1, 8)
;MaxDate += 1, D
;MaxDate := SubStr(MaxDate, 1, 8)
;Gui, Add, MonthCal, Range%MinDate%-%MaxDate% ; ok
;Gui, Add, DateTime, wp 1 Range%MinDate%-%MaxDate% ; ok
;Gui, Add, MonthCal, Range%MinDate%- ; ok
;Gui, Add, DateTime, wp 1 Range%MinDate%- ; ok
;Gui, Show
;Return
;GuiClose:
;ExitApp