*/
WCF.Date = {};
+/**
+ * Provides a date picker for date input fields.
+ */
+WCF.Date.Picker = {
+ /**
+ * Initializes the jQuery UI based date picker.
+ */
+ init: function() {
+ $('input[type=date]').each(function(index, input) {
+ // do *not* use .attr()
+ var $input = $(input).prop('type', 'text');
+
+ // TODO: we should support all these braindead date formats, at least within output
+ $input.datepicker({
+ changeMonth: true,
+ changeYear: true,
+ dateFormat: 'yy-mm-dd',
+ yearRange: '1900:2038' // TODO: make it configurable?
+ });
+ });
+ }
+};
+
/**
* Provides utility functions for date operations.
*/
/**
* Handles relative time designations.
*/
-WCF.Date.Time = function() { this.init(); };
-WCF.Date.Time.prototype = {
+WCF.Date.Time = Class.extend({
/**
* Initializes relative datetimes.
*/
$(element).text($string.replace(/\%date\%/, $date).replace(/\%time\%/, $time));
}
}
-};
+});
/**
* Hash-like dictionary. Based upon idead from Prototype's hash
--- /dev/null
+.ui-datepicker {
+ background-color: rgba(255, 255, 255, .7);
+ border: 1px solid @wcfBorderColor;
+ min-width: 200px;
+ padding: 4px;
+
+ .borderRadius(5px);
+
+ .ui-datepicker-prev {
+ float: left;
+ }
+
+ .ui-datepicker-next {
+ float: right;
+ }
+
+ .ui-datepicker-title{
+ text-align: center;
+
+ &:after {
+ clear: both;
+ content: "";
+ display: block;
+ }
+ }
+
+ .ui-datepicker-calendar {
+ margin-top: 7px;
+
+ td {
+ padding: 2px;
+ }
+ }
+}
\ No newline at end of file