第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在fullCalendar.io中將UTC日期轉(zhuǎn)換為用戶時(shí)區(qū)

如何在fullCalendar.io中將UTC日期轉(zhuǎn)換為用戶時(shí)區(qū)

寶慕林4294392 2021-04-29 17:28:17
我有UTC格式的日期和時(shí)間,例如:我的日歷生成代碼。我正在使用fullcalendar.io。//for loop startsessionCalendar.push(    {      title: `${course["course_name"]}`,      start: start_date_time.split(" ").join("T"),      end: end_date_time.split(" ").join("T"),    },)//for loops end如您所見,我T在日期和時(shí)間中間添加了UTC格式。var calendarEl = document.getElementById('calendar');var calendar = new FullCalendar.Calendar(calendarEl, {  plugins: [ 'dayGrid', 'timeGrid', 'list', 'interaction' ],  header: {    left: 'prev,next today',    center: 'title',    right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'  },  defaultDate: '2019-04-12',  navLinks: true,   editable: false,  eventLimit: true,  events: sessionCalendar,  timeZone: timeZone // var timeZone = "Asia/Kolkata"});calendar.render();在上面的代碼中,我設(shè)置了動(dòng)態(tài)的timeZone值。不過,我看到的日期和時(shí)間start_date_time與屏幕截圖中的UTC格式相同。如何將UTC日期和時(shí)間轉(zhuǎn)換為用戶指定的時(shí)區(qū)?根據(jù)評(píng)論。我在末尾加了“ Z”
查看完整描述

2 回答

?
繁星淼淼

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊

函數(shù)convertDateAccordingToTZ(dateString:string,timeZoneOffset:number = 0){


const dateObj = new Date(dateString);

const calculatedOffset = dateObj.getTimezoneOffset() + (timeZoneOffset * 60);

const formattedTime = dateObj.valueOf() + (calculatedOffset * 60000);


return new Date(formattedTime);

}


查看完整回答
反對(duì) 回復(fù) 2021-05-13
  • 2 回答
  • 0 關(guān)注
  • 237 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)