Skip to content

Commit

Permalink
Añadido renderizado de meses y años en la experiencia
Browse files Browse the repository at this point in the history
  • Loading branch information
d074064 committed Mar 13, 2024
1 parent 9b53522 commit e2ba2d6
Show file tree
Hide file tree
Showing 7 changed files with 1,331 additions and 1,245 deletions.
4 changes: 3 additions & 1 deletion MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@inherits LayoutComponentBase
@using CV.Shared.Resources
@inherits LayoutComponentBase
@inject IStringLocalizer<AllResourcesRes> AllResourcesResolver

<main>
<CV.Shared.NavMenu/>
Expand Down
45 changes: 43 additions & 2 deletions Pages/Experiencia.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,35 @@
</li>
</p>
</div>
<div class="flex-shrink-0"><span class="text-primary">jun. 2022 -@AllResourcesResolver["actualidad"] · @(((DateTime.Now.Year - 2022) * 12) + DateTime.Now.Month - 5) @AllResourcesResolver["meses"]</span></div>
<div class="flex-shrink-0"><span class="text-primary">jun. 2022 -@AllResourcesResolver["actualidad"] ·

@{

var datediff = ObtenerDiferenciaAniosMeses(new DateTime(2022, 5, 1), DateTime.Now);
}
@datediff.Item1
@if (datediff.Item1 == 1)
{
@AllResourcesResolver["year"]
}
else
{
@AllResourcesResolver["years"]
}

@datediff.Item2
@if (datediff.Item1 == 2)
{
@AllResourcesResolver["mes"]
} else
{
@AllResourcesResolver["meses"]
}




</span></div>

</div>

Expand Down Expand Up @@ -72,4 +100,17 @@
</div>
</div>
</section>
<hr class="m-0" />
<hr class="m-0" />


@code{
Tuple<int, int> ObtenerDiferenciaAniosMeses(DateTime fechaInicio, DateTime fechaFin)
{
int totalMeses = ((fechaFin.Year - fechaInicio.Year) * 12) + DateTime.Now.Month - fechaInicio.Month;
int anios = totalMeses / 12;
int meses = totalMeses % 12;

return Tuple.Create(anios, meses);
}

}
4 changes: 2 additions & 2 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@page "/CV"


<RadzenTabs RenderMode="TabRenderMode.Client">
<RadzenTabs RenderMode="TabRenderMode.Client" Style="background-image:conic-gradient()">
<Tabs>
<RadzenTabsItem Text="Inicio">
<Inicio/>
Expand Down Expand Up @@ -47,7 +47,7 @@
</Tabs>
</RadzenTabs>


@* *
<Carousel @bind-SelectedSlide=@selectedSlide Autoplay=false>
<CarouselSlide Name="1">
Expand Down
Loading

0 comments on commit e2ba2d6

Please sign in to comment.