pub struct DateField {
pub name: String,
pub label: Option<String>,
pub required: bool,
pub help_text: Option<String>,
pub widget: Widget,
pub initial: Option<Value>,
pub input_formats: Vec<String>,
pub localize: bool,
pub locale: Option<String>,
}Expand description
DateField for date input
Fields§
§name: String§label: Option<String>§required: bool§help_text: Option<String>§widget: Widget§initial: Option<Value>§input_formats: Vec<String>§localize: bool§locale: Option<String>Implementations§
Source§impl DateField
impl DateField
Sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Create a new DateField with the given name
§Examples
use reinhardt_forms::fields::DateField;
let field = DateField::new("birth_date".to_string());
assert_eq!(field.name, "birth_date");
assert!(field.required);Sourcepub fn with_localize(self, localize: bool) -> Self
pub fn with_localize(self, localize: bool) -> Self
Enable localization for this field
§Examples
use reinhardt_forms::fields::DateField;
let field = DateField::new("date".to_string()).with_localize(true);
assert!(field.localize);Sourcepub fn with_locale(self, locale: String) -> Self
pub fn with_locale(self, locale: String) -> Self
Set the locale for this field
§Examples
use reinhardt_forms::fields::DateField;
let field = DateField::new("date".to_string()).with_locale("en_US".to_string());
assert_eq!(field.locale, Some("en_US".to_string()));Trait Implementations§
Source§impl FormField for DateField
impl FormField for DateField
fn name(&self) -> &str
fn label(&self) -> Option<&str>
fn required(&self) -> bool
fn help_text(&self) -> Option<&str>
fn widget(&self) -> &Widget
fn initial(&self) -> Option<&Value>
fn clean(&self, value: Option<&Value>) -> FieldResult<Value>
Auto Trait Implementations§
impl Freeze for DateField
impl RefUnwindSafe for DateField
impl Send for DateField
impl Sync for DateField
impl Unpin for DateField
impl UnsafeUnpin for DateField
impl UnwindSafe for DateField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more