This commit is contained in:
mmrbnjd
2024-03-31 01:33:17 +03:30
parent a9e3afdea4
commit 90545682b6
11 changed files with 120 additions and 110 deletions

View File

@@ -1,4 +1,5 @@
@using System.Globalization
@inject HttpClient _hc
<!-- header top area -->
<div class="header-top__area header-top__space z-index-3 d-none d-md-block tp-header-top-animation">
<div class="container">
@@ -21,18 +22,24 @@
<!-- header bottom -->
@code {
DateTime dtserver = DateTime.Now;
protected override async Task OnInitializedAsync()
{
dtserver = await _hc.GetFromJsonAsync<DateTime>("Base/DateTimeServer");
await base.OnInitializedAsync();
}
}
@functions{
public static string GetTodyPersianDatetime()
public string GetTodyPersianDatetime()
{
PersianCalendar pcDate = new PersianCalendar();
int persianYear = pcDate.GetYear(DateTime.Now);
int persianMonth = pcDate.GetMonth(DateTime.Now);
int persianDay = pcDate.GetDayOfMonth(DateTime.Now);
int persianYear = pcDate.GetYear(dtserver);
int persianMonth = pcDate.GetMonth(dtserver);
int persianDay = pcDate.GetDayOfMonth(dtserver);
string _DayOfWeek = "";
switch (DateTime.Now.DayOfWeek)
switch (dtserver.DayOfWeek)
{
case DayOfWeek.Saturday:
_DayOfWeek = " شنبه ";