Class: DateTimeControl

wp.customize. DateTimeControl


new DateTimeControl()

Class wp.customize.DateTimeControl.
Since:
  • 4.9.0
Source:

Extends

Members


defaults :object

Default params.
Type:
  • object
Since:
  • 4.9.0
Inherited From:
Source:

Methods


<private> addNewPage()

Add a new page to a dropdown-pages control reusing menus code for this.
Since:
  • 4.7.0
Inherited From:
Source:
Returns:
Type
void

convertHourToTwentyFourHourFormat(hourInTwelveHourFormat, meridian)

Convert hour in twelve hour format to twenty four hour format.
Parameters:
Name Type Description
hourInTwelveHourFormat string Hour in twelve hour format.
meridian string Either 'am' or 'pm'.
Since:
  • 4.9.0
Source:
Returns:
Hour in twenty four hour format.
Type
string

convertInputDateToString()

Converts input values to string in Y-m-d H:i:s format.
Since:
  • 4.9.0
Source:
Returns:
Date string.
Type
string

embed()

Embed the control into the page.
Inherited From:
Source:

expand( [params])

Normal controls do not expand, so just expand its parent
Parameters:
Name Type Argument Description
params Object <optional>
Inherited From:
Source:

getNotificationsContainerElement()

Get the element inside of a control's container that contains the validation error message. Control subclasses may override this to return the proper container to render notifications into. Injects the notification container for existing controls that lack the necessary container, including special handling for nav menu items and widgets.
Since:
  • 4.6.0
Inherited From:
Source:
Returns:
Setting validation message element.
Type
jQuery

isFutureDate()

Check if the date is in the future.
Since:
  • 4.9.0
Source:
Returns:
True if future date.
Type
boolean

linkElements()

Link elements between settings and inputs.
Since:
  • 4.7.0
Inherited From:
Source:
Returns:
Type
void

onChangeActive(active, args)

Update UI in response to a change in the control's active state. This does not change the active state, it merely handles the behavior for when it does change.
Parameters:
Name Type Description
active Boolean
args Object
Properties
Name Type Description
duration Number
completeCallback function
Since:
  • 4.1.0
Inherited From:
Source:

parseDateTime(datetime)

Parse datetime string.
Parameters:
Name Type Description
datetime string Date/Time string. Accepts Y-m-d[ H:i[:s]] format.
Since:
  • 4.9.0
Source:
Returns:
Returns object containing date components or null if parse error.
Type
object | null

populateDateInputs()

Populates date inputs in date fields.
Since:
  • 4.9.0
Source:
Returns:
Whether the inputs were populated.
Type
boolean

populateSetting()

Populate setting value from the inputs.
Since:
  • 4.9.0
Source:
Returns:
If setting updated.
Type
boolean

ready()

Initialize behaviors.
Since:
  • 4.9.0
Overrides:
Source:
Returns:
Type
void

renderContent()

Render the control from its JS template, if it exists. The control's container must already exist in the DOM.
Since:
  • 4.1.0
Inherited From:
Source:

renderNotifications()

Render notifications. Renders the `control.notifications` into the control's container. Control subclasses may override this method to do their own handling of rendering notifications.
This:
Since:
  • 4.6.0
Inherited From:
Deprecated:
  • in favor of `control.notifications.render()`
Source:

setupNotifications()

Set up notifications.
Since:
  • 4.9.0
Inherited From:
Source:
Returns:
Type
void

toggle()

Inherited From:
Deprecated:
  • 4.1.0 Use this.onChangeActive() instead.
Source:

toggleFutureDateNotification(notify)

Toggle future date notification for date control.
Parameters:
Name Type Description
notify boolean Add or remove the notification.
Since:
  • 4.9.0
Source:
Returns:
Type
wp.customize.DateTimeControl

updateDaysForMonth()

Updates number of days according to the month and year selected.
Since:
  • 4.9.0
Source:
Returns:
Type
void

validateInputs()

Validates if input components have valid date and time.
Since:
  • 4.9.0
Source:
Returns:
If date input fields has error.
Type
boolean