// <auto-generated/>
#pragma warning disable 1591
#pragma warning disable 0414
#pragma warning disable 0649
#pragma warning disable 0169

namespace RichTextEditor_Test.Pages
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Components;
#nullable restore
#line 1 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using RichTextEditor_Test;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using RichTextEditor_Test.Shared;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Syncfusion.Blazor;

#line default
#line hidden
#nullable disable
#nullable restore
#line 1 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\RencoreDateFormatterComponent.razor"
using Rencore.Cloud.Core.CommonHelpers.Date;

#line default
#line hidden
#nullable disable
    public partial class RencoreDateFormatterComponent : Microsoft.AspNetCore.Components.ComponentBase
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
        }
        #pragma warning restore 1998
#nullable restore
#line 35 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\RencoreDateFormatterComponent.razor"
       

    private string dateDifferenceFromNow = "";
    private string actualDate = "";
    private string id = "rcc" + Guid.NewGuid().ToString();

    [Parameter]
    public DateTime? Date { get; set; }

    [Parameter]
    public string UpdateTrigger { get; set; }

    [Parameter]
    public bool ShowToolTip { get; set; } = true;

    [Parameter]
    public bool ShowActualDate { get; set; } = false;

    [Parameter]
    public bool ShowOnlyDate { get; set; } = false;

    [Parameter]
    public string DateNumberFormat { get; set; }

    protected override async Task OnParametersSetAsync()
    {
        await UpdateUI();
    }

    public async Task UpdateUI()
    {
        if (Date.HasValue)
        {
            if (string.IsNullOrEmpty(DateNumberFormat))
            {
                DateNumberFormat = await ConfigurationDBService.GetCurrentUserDateNumberFormat();
            }
            TimeZoneInfo dateTimeZone = await ConfigurationDBService.GetCurrentUserTimeZone();

            actualDate = DateHelper.FormatDateTime(Date.Value, DateNumberFormat, dateTimeZone, ShowOnlyDate);

            if (Date > DateTime.UtcNow)
            {
                // date is in future, just show the date as string
                dateDifferenceFromNow = actualDate;
            }
            else
            {
                dateDifferenceFromNow = Rencore.Cloud.Core.Helpers.DateFormatter.FormatDate(Date.Value);
            }

            // await InvokeAsync(StateHasChanged);
        }
    }

#line default
#line hidden
#nullable disable
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private Rencore.Cloud.Web.Core.Interfaces.IConfigurationDBService ConfigurationDBService { get; set; }
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private Rencore.Cloud.Core.Authentication.IUser WebUser { get; set; }
    }
}
#pragma warning restore 1591
