Am working with Asp.net core & jquery project I have added the Clock.Provider = ClockProviders.Utc; under MVC startup ConfigureServices method, and now am having difficulties to present any date with the user selected timezone. Any help would be appreciated
6 Answer(s)
-
0
and librarysettings is not being render and if i call it from the layout abp.clock.provider.supportsMultipleTimezone is coming undefined
-
0
Hi,
Are you trying to do that in a datatable or in cshtml ?
-
0
Hi,
in cshtml
Ive noticed that creationtime,lastmodificationdatetime are being converted to UTC, but any other custom dates no, and kindly note that am working with the Public project and ive implemeted the clock provider in both the MVC and Public projects.
-
0
Hi,
If you don't make any specific change and when you use ClockProviders.Utc, dates should be converted to UTC when saved to database.
- Could you share a sample Controller/AppService, its related method and input class which contains the date field ?
- Please also share the string value sent from client to server during the save operation.
-
0
input class public class CreateOrEditAvailabilityDto : EntityDto<int?> {
public DateTime Day { get; set; } public DateTime Time { get; set; } public DateTime Datetime { get; set; } public bool Generated { get; set; } public string Timezone { get; set; } public AvailabilityStatusEnum Status { get; set; } public int SpecialistId { get; set; } public int ProductTypeId { get; set; } } **save function** public JsonResult SaveCalendar([FromBody] List<CalendarItem> list) { var OrgList = list.FindAll(x => x.type != "none" && x.type != "" && x.Id == 0); foreach (var item in OrgList) { CreateOrEditAvailabilityDto calendarItem = new CreateOrEditAvailabilityDto(); calendarItem.Day = DateTime.Parse(item.day); calendarItem.Time = DateTime.Parse(item.time); calendarItem.Datetime =calendarItem.Datetime; calendarItem.SpecialistId = 0; calendarItem.Status = AvailabilityStatusEnum.Available; _availabilitiesAppService.CreateOrEdit(calendarItem); } return Json(list); } ** AppService method** protected virtual async Task Create(CreateOrEditAvailabilityDto input) { var availability = ObjectMapper.Map<Availability>(input); if (AbpSession.TenantId != null) { availability.TenantId = (int?)AbpSession.TenantId; } if (input.SpecialistId == 0) { availability.SpecialistId = _lookup_specialistRepository.FirstOrDefault(x => x.UserId == AbpSession.UserId).Id; } await _availabilityRepository.InsertAsync(availability); }
-
0
Hi,
Could you also share a sample json data which causes this problem ?