1 /** 2 * Copyright © DiamondMVC 2019 3 * License: MIT (https://github.com/DiamondMVC/Diamond/blob/master/LICENSE) 4 * Author: Jacob Jensen (bausshf) 5 */ 6 module diamond.web.elements.date; 7 8 import diamond.web.elements.input; 9 10 /// Wrapper around a date input. 11 final class Date : Input 12 { 13 private: 14 /// The min date. 15 string _minDate; 16 /// The max date. 17 string _maxDate; 18 19 public: 20 final: 21 /// Creates a new date input. 22 this() 23 { 24 super(); 25 26 addAttribute("type", "date"); 27 } 28 29 /** 30 * Creates a new date input. 31 * Params: 32 * date = The date of the input. 33 */ 34 this(string date) 35 { 36 this(); 37 38 super.value = date; 39 } 40 41 @property 42 { 43 /// Gets the min date. 44 string minDate() { return _minDate; } 45 46 /// Sets the min date. 47 void minDate(string newMinDate) 48 { 49 _minDate = newMinDate; 50 51 addAttribute("min", _minDate); 52 } 53 54 /// Gets the max date. 55 string maxDate() { return _maxDate; } 56 57 /// Sets the min date. 58 void maxDate(string newMaxDate) 59 { 60 _maxDate = newMaxDate; 61 62 addAttribute("max", _maxDate); 63 } 64 } 65 }