-
Notifications
You must be signed in to change notification settings - Fork 0
DateBox
View:
<ma-date-box
value="date">
</ma-date-box>
Controller:
$scope.date = '2016-07-25T00:00:00Z';
Determines whether a button is displayed allowing the user to empty a previously set value.
Boolean
false
Sets the field:
View:
<ma-date-box
can-reset="true">
</ma-date-box>
The culture used to parse a provided value.
Supported cultures: 'en-GB'
, 'en-US'
.
String
null
Sets culture
field:
View:
<ma-date-box
culture="'en-US'">
</ma-date-box>
The format used for displaying a date.
String
'dd MMM yyyy'
Sets displayFormat
field:
View:
<ma-date-box
display-format="'dd/MM/yy'">
</ma-date-box>
The format used for saving a date.
String
'yyyy-MM-ddTHH:mm:ssZ'
Sets format
field:
View:
<ma-date-box
format="'dd/MM/yy HH:mm'">
</ma-date-box>
Determines whether the user can enter time (hours and minutes) along with date.
Boolean
false
Sets the field:
View:
<ma-date-box
has-time="true">
</ma-date-box>
Unique identifier of the component.
String
''
Sets the field:
View:
<ma-date-box
id="date">
</ma-date-box>
An object that provides API for the component.
View:
<ma-date-box
instance="dateBox">
</ma-date-box>
Controller:
$scope.dateBox = {};
// API object can be used after the component has been initialized by AngularJS,
// which is often after a timeout or in callback functions.
$timeout(function() {
var isValid = dateBox.isValid();
});
Determines whether a component is disabled.
Boolean
false
Sets the field:
View:
<ma-date-box
is-disabled="true">
</ma-date-box>
Determines whether a value is required.
If a value is not set by the user the component will become invalid and will be highlighted accordingly.
Boolean
false
Sets the field:
View:
<ma-date-box
is-required="true">
</ma-date-box>
A maximum date the user can enter (inclusive).
String
Allowed format is 'yyyy-MM-ddTHH:mm:ssZ'
, e.g. '2016-10-15T00:00:00Z'
.
null
Sets value
field:
View:
<ma-date-box
max-date="maxDate">
</ma-date-box>
Controller:
$scope.maxDate = '2016-10-15T00:00:00Z';
A minimum date the user can enter (inclusive).
String
Allowed format is 'yyyy-MM-ddTHH:mm:ssZ'
, e.g. '2016-10-15T00:00:00Z'
.
null
Sets value
field:
View:
<ma-date-box
min-date="minDate">
</ma-date-box>
Controller:
$scope.minDate = '2016-10-15T00:00:00Z';
A function used to parse the date entered by the user.
The function can be used to add support for custom date formats.
Function
null
Object
date String
Date or null if date is empty.
Sets parser
field:
View:
<ma-date-box
parser="parser">
</ma-date-box>
Controller:
$scope.parser = function(date) {
// Parse the date and return it along with time zone offset.
var parsedDate = new Date(date);
return {
date: parsedDate,
offset: 240
}
};
The time zone used to display and save a date.
String
'Z'
By default the date is displayed and saved in UTC.
Both '-07:00' and 'GMT-07:00' are valid time zones.
Sets timeZone
field:
View:
<ma-date-box
time-zone="'-07:00'">
</ma-date-box>
A list of validators which is used to validate the value each time it is changed.
Array
null
Sets the field:
View:
<ma-date-box
validators="[dateValidator]">
</ma-date-box>
Controller:
$scope.dateValidator = {
method: function(date) {
// Check the date somehow and return true or false.
return true;
}
};
A value of the component (representing a date) which is bound to an outer scope with two-way data binding.
String
null
Sets value
field:
View:
<ma-date-box
value="date">
</ma-date-box>
Controller:
$scope.date = '2016-07-25T00:00:00Z';
Fires when the value is changed by the user.
maValue Object
Value or null if the value is empty.
Subscribes to change
event:
View:
<ma-date-box
change="change(maValue)">
</ma-date-box>
Controller:
$scope.change = function(date) {
// Handle the event.
};