using Microsoft.AspNetCore.Components; using NodaTime; using NodaTime.Text; using System.Threading.Tasks; namespace JobsJobsJobs.Client.Shared { public partial class FullDate : ComponentBase { /// /// The pattern with which dates will be formatted /// private static readonly ZonedDateTimePattern Pattern = ZonedDateTimePattern.CreateWithCurrentCulture("ld", DateTimeZoneProviders.Tzdb); /// /// The date to be formatted /// [Parameter] public Instant TheDate { get; set; } /// /// The formatted date /// private string Translated { get; set; } = ""; protected override async Task OnInitializedAsync() => Translated = Pattern.Format(TheDate.InZone(await state.GetTimeZone(js))); } }