Checking a DatePicker's Date Range

Applies to TestComplete 15.47, last modified on January 20, 2023
Getting wMaxDate and wMinDate Properties

To determine the minimum and maximum dates of a date picker control, use the wMaxDate and wMinDate properties of the iOS DatePicker object that TestComplete associates with that control. These properties return the values of the first and the last possible days of the DatePicker control. The following example determines the minimum and maximum dates of the DatePicker and posts them to the log:

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the DatePicker object
  var p = Mobile.Device().Process("SampleApp");
  var datepicker = p.Window().DatePicker();

  // Post DatePicker minimum and maximum dates to the log
  Log.Message(datepicker.wMaxDate);
  Log.Message(datepicker.wMinDate);
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the DatePicker object 
  p = Mobile.Device().Process("SampleApp")
  datepicker = p.Window().DatePicker()

  # Post DatePicker minimum and maximum dates to the log
  Log.Message(datepicker.wMaxDate)
  Log.Message(datepicker.wMinDate)

VBScript

Sub Test()
  Dim p, datepicker
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the DatePicker object
  Set p = Mobile.Device.Process("SampleApp")
  Set datepicker = p.Window(2).DatePicker

  ' Post DatePicker minimum and maximum dates to the log
  Log.Message(datepicker.wMaxDate)
  Log.Message(datepicker.wMinDate)
End Sub

DelphiScript

procedure Test();
var
  p, datepicker;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the DatePicker object
  p := Mobile.Device.Process('SampleApp');
  datepicker := p.Window(2).DatePicker;

  // Post DatePicker minimum and maximum dates to the log
  Log.Message(datepicker.wMaxDate);
  Log.Message(datepicker.wMinDate);
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the DatePicker object
  var p = Mobile["Device"].Process("SampleApp");
  var datepicker = p["Window"](2)["DatePicker"]();

  // Post DatePicker minimum and maximum dates to the log
  Log["Message"](datepicker["wMaxDate"]);
  Log["Message"](datepicker["wMinDate"]);
}

The date format of the wMinDate and wMaxDate properties depends on the regional setting of the computer running the test, not the settings of the mobile device.
Checking Date Range From Keyword Tests

To get the mimimum and maximum date picker values from keyword tests, call the methods described above by using the On-Screen Action or Call Object Method operation. See Calling Object Methods.

See Also

Working With iOS Date Picker Controls
wMaxDate Property (Mobile Controls)
wMinDate Property (Mobile Controls)
Changing DatePicker Date

Highlight search results