@inherits DInputBase @using System.Globalization @* daisyUI Calendar (Cally): https://daisyui.com/components/calendar/ . Wraps the web component from wwwroot/vendor/cally.js; value, min and max are yyyy-MM-dd, and Blazor reads the element's value on its change event. Other Cally attributes (locale, first-day-of-week, months) pass through. *@ @code { [Parameter] public DateOnly? Min { get; set; } [Parameter] public DateOnly? Max { get; set; } [Parameter] public string PreviousText { get; set; } = "Previous"; [Parameter] public string NextText { get; set; } = "Next"; static string Format(DateOnly? date) => date?.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); protected override string FormatValueAsString(DateOnly? value) => Format(value); protected override bool TryParseValueFromString(string value, out DateOnly? result, out string validationErrorMessage) { validationErrorMessage = null; result = null; if (string.IsNullOrEmpty(value)) return true; if (DateOnly.TryParseExact(value, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var date)) { result = date; return true; } validationErrorMessage = $"The {DisplayName ?? FieldIdentifier.FieldName} field is not a valid date."; return false; } void OnChange(ChangeEventArgs e) => CurrentValueAsString = e.Value?.ToString(); }