當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript moment-timezone類代碼示例

本文整理匯總了TypeScript中moment-timezone的典型用法代碼示例。如果您正苦於以下問題:TypeScript moment-timezone類的具體用法?TypeScript moment-timezone怎麽用?TypeScript moment-timezone使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了moment-timezone類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: makeChartData

    protected makeChartData(chartData: IChartDataFromServer): {[key: string]: any} {
        const xArr = [];
        const jvmArr = [];
        const systemArr = [];
        const maxArr = [];

        const xData = chartData.charts.x;
        const cpuJVM = chartData.charts.y['CPU_LOAD_JVM'];
        const cpuSystem = chartData.charts.y['CPU_LOAD_SYSTEM'];
        const dataCount = xData.length;

        for ( let i = 0 ; i < dataCount ; i++ ) {
            xArr.push(moment(xData[i]).tz(this.timezone).format(this.dateFormat[0]) + '#' + moment(xData[i]).tz(this.timezone).format(this.dateFormat[1]));
            maxArr.push(100);
            if ( cpuJVM.length === 0 ) {
                continue;
            }
            jvmArr.push(this.parseData(cpuJVM[i][1]));
            systemArr.push(this.parseData(cpuSystem[i][1]));
        }
        return {
            x: xArr,
            jvm: jvmArr,
            system: systemArr
        };
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:26,代碼來源:transaction-view-cpu-chart-container.component.ts

示例2: makeChartData

    protected makeChartData(chartData: IChartDataFromServer): {[key: string]: any} {
        const xArr = [];
        const maxArr = [];
        const minArr = [];
        const avgArr = [];
        const maxAgentIdArr = [];
        const minAgentIdArr = [];

        const xData = chartData.charts.x;
        const responseTime = chartData.charts.y['RESPONSE_TIME'];
        const dataCount = xData.length;

        for ( let i = 0 ; i < dataCount ; i++ ) {
            xArr.push(moment(xData[i]).tz(this.timezone).format(this.dateFormat[0]) + '#' + moment(xData[i]).tz(this.timezone).format(this.dateFormat[1]));
            if (responseTime[i]) {
                minArr.push(this.parseData(responseTime[i][0]));
                minAgentIdArr.push(responseTime[i][1]);
                maxArr.push(this.parseData(responseTime[i][2]));
                maxAgentIdArr.push(responseTime[i][3]);
                avgArr.push(this.parseData(responseTime[i][4]));
            }
        }
        return {
            x: xArr,
            maxArr: maxArr,
            minArr: minArr,
            avgArr: avgArr,
            minAgentIdArr,
            maxAgentIdArr,
        };
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:31,代碼來源:application-response-time-chart-container.component.ts

示例3: makeChartData

    protected makeChartData(chartData: IChartDataFromServer): {[key: string]: any} {
        const xArr = [];
        const maxArr = [];
        const minArr = [];
        const avgArr = [];
        const maxAgentIdArr = [];
        const minAgentIdArr = [];

        const xData = chartData.charts.x;
        const memoryNonHeap = chartData.charts.y['MEMORY_NON_HEAP'];
        const dataCount = xData.length;

        for ( let i = 0 ; i < dataCount ; i++ ) {
            xArr.push(moment(xData[i]).tz(this.timezone).format(this.dateFormat[0]) + '#' + moment(xData[i]).tz(this.timezone).format(this.dateFormat[1]));
            if (memoryNonHeap[i]) {
                minArr.push(this.parseData(memoryNonHeap[i][0]));
                minAgentIdArr.push(memoryNonHeap[i][1]);
                maxArr.push(this.parseData(memoryNonHeap[i][2]));
                maxAgentIdArr.push(memoryNonHeap[i][3]);
                avgArr.push(this.parseData(memoryNonHeap[i][4]));
            }
        }
        return {
            x: xArr,
            maxArr,
            minArr,
            avgArr,
            minAgentIdArr,
            maxAgentIdArr,
        };
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:31,代碼來源:application-jvm-non-heap-chart-container.component.ts

示例4: makeChartData

    protected makeChartData(chartData: IChartDataFromServer): {[key: string]: any} {
        const xArr = [];
        const maxArr = [];
        const minArr = [];
        const avgArr = [];
        const maxAgentIdArr = [];
        const minAgentIdArr = [];

        const xData = chartData.charts.x;
        const activeTraceCount = chartData.charts.y['ACTIVE_TRACE_COUNT'];
        const dataCount = xData.length;

        for (let i = 0; i < dataCount; i++) {
            xArr.push(moment(xData[i]).tz(this.timezone).format(this.dateFormat[0]) + '#' + moment(xData[i]).tz(this.timezone).format(this.dateFormat[1]));
            if (activeTraceCount[i]) {
                minArr.push(this.parseData(activeTraceCount[i][0]));
                minAgentIdArr.push(activeTraceCount[i][1]);
                maxArr.push(this.parseData(activeTraceCount[i][2]));
                maxAgentIdArr.push(activeTraceCount[i][3]);
                avgArr.push(this.parseData(activeTraceCount[i][4]));
            }
        }
        return {
            x: xArr,
            maxArr,
            minArr,
            avgArr,
            minAgentIdArr,
            maxAgentIdArr,
        };
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:31,代碼來源:application-active-thread-chart-container.component.ts

示例5: makeChartData

    protected makeChartData(chartData: IChartDataFromServer): {[key: string]: any} {
        const xArr = [];
        const fastArr = [];
        const normalArr = [];
        const slowArr = [];
        const verySlowArr = [];

        const xData = chartData.charts.x;
        const atFast = chartData.charts.y['ACTIVE_TRACE_FAST'];
        const atNormal = chartData.charts.y['ACTIVE_TRACE_NORMAL'];
        const atSlow = chartData.charts.y['ACTIVE_TRACE_SLOW'];
        const atVerySlow = chartData.charts.y['ACTIVE_TRACE_VERY_SLOW'];
        const dataCount = xData.length;

        for ( let i = 0 ; i < dataCount ; i++ ) {
            xArr.push(moment(xData[i]).tz(this.timezone).format(this.dateFormat[0]) + '#' + moment(xData[i]).tz(this.timezone).format(this.dateFormat[1]));
            if ( atFast.length === 0 ) {
                continue;
            }
            fastArr.push(this.parseData(atFast[i][2]));
            normalArr.push(this.parseData(atNormal[i][2]));
            slowArr.push(this.parseData(atSlow[i][2]));
            verySlowArr.push(this.parseData(atVerySlow[i][2]));
        }
        return {
            x: xArr,
            fast: fastArr,
            normal: normalArr,
            slow: slowArr,
            verySlow: verySlowArr
        };
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:32,代碼來源:agent-active-thread-chart-container.component.ts

示例6: getDaysCurrent

export function getDaysCurrent(DQ,index) {
  if(!DQ.answers[index])
    return 0;
  const indexLastAnwer = Object.keys(DQ['answers'][index])[Object.keys(DQ['answers'][index]).length - 1];
  const lastAnswerString = DQ['answers'][index][indexLastAnwer]['date'];
  return getDiferenceDays(moment(),moment(lastAnswerString).format()); 
}
開發者ID:dekonunes,項目名稱:ConneCT-App,代碼行數:7,代碼來源:getDaysCurrent.ts

示例7: it

 it('should format date/moment objects correctly with timezones', () => {
   expect(pipe.transform(new Date('2014-06-01T16:16:00Z'), 'America/Toronto', 'America/Toronto')).toBe('16:16');
   expect(pipe.transform(new Date('2014-06-01T07:00:00Z'), 'America/Toronto', 'Europe/Berlin')).toBe('13:00');
   expect(pipe.transform(moment('2014-06-01T07:00:00Z'), 'America/Toronto', 'Europe/Berlin')).toBe('13:00');
   expect(pipe.transform(moment.utc('2014-06-01T07:00:00Z'), 'America/Toronto', 'Europe/Berlin')).toBe('13:00');
   expect(pipe.transform(moment('2014-06-01T18:30:00Z'), 'America/Toronto', 'Europe/Berlin')).toBe('00:30');
   expect(pipe.transform(moment('2014-06-01T09:30:00Z'), 'America/Toronto', 'Europe/Berlin')).toBe('15:30');
 });
開發者ID:Sirimangalo,項目名稱:meditation-plus-angular,代碼行數:8,代碼來源:hour.pipe.spec.ts

示例8: moment

  events.forEach(event => {
    let currentDate = moment(event.start);
    let eventEndDate = moment(event.start).add(event.duration, 'minutes').subtract(1, 'second');
    if (event.isAllDay) {
      currentDate = currentDate.startOf('day');
      eventEndDate = eventEndDate.endOf('day');
    }
    let startDateStr = currentDate.format('YYYY-MM-DD');
    let endDateStr = eventEndDate.format('YYYY-MM-DD');

    while (currentDate.isBefore(eventEndDate) && currentDate.isBefore(endDate)) {
      let currentDateStr = currentDate.format('YYYY-MM-DD');
      if (!eventMap.dates[currentDateStr]) {
        eventMap.dates[currentDateStr] = [];
      }
      if (!eventMap.bounds[event.id]) {
        eventMap.bounds[event.id] = {
          startDateStr: currentDateStr,
          endDateStr: eventEndDate.format('YYYY-MM-DD'),
          level: 0,
        };
      }

      // Calculate how many days this event spans.  By default it will be 1,
      // but if it's a multi-day event the span will be to the end of the
      // week, or the end of the event, whichever is first.  It goes to the
      // end of the week because a new event box will likely need to be drawn
      // in the row for the following week.
      //
      // Note that we had to calculate the difference in hours instead of
      // days because moment calculates the difference in UTC, so it may
      // cross day boundaries differently.  Hours is more accurate.
      let span = 1 + moment(eventEndDate).endOf('day').diff(moment(currentDate).startOf('day'), 'days');
      span = Math.min(7 - currentDate.day(), span);

      eventMap.dates[currentDateStr].push({
        currentDateStr: currentDateStr,
        startDateStr: startDateStr,
        endDateStr: endDateStr,
        id: event.id,
        level: 0,
        span: span,
        isStart: true,
        isEnd: true,
        isAllDay: event.isAllDay,
        originalEvent: event,
      });

      // Don't simply add 1 day due to some timezones doing DST shifts at midnight
      // resulting in ambiguity and an infinite loop in this code.
      currentDate.add(30, 'hour').startOf('day');
    }
  });
開發者ID:lehresman,項目名稱:callay-engine,代碼行數:53,代碼來源:callay_engine.ts

示例9: Promise

 return new Promise(async (resolve, reject) => {
   try {
     const response = await GibsonApi.fetchMemberLessonSkywayChat(
       registrationId
     )
     resolve(response)
     if (typeof response.list === 'undefined') {
       resolve()
       return
     }
     for (let message of response.list) {
       message.sent_by = await dispatch(
         'replaceSentBy',
         Number(message.sent_by)
       )
       message.created_at_hhmm = Moment(message.created_at, 'YYYYMMDDHHmmss')
         .add(rootState.global.serverTimeOffset, 'seconds')
         .format('HH:mm')
       const formattedMessage: string = await dispatch(
         'formatSkyWayChatMessage',
         message
       )
       commit('addChatMessage', {
         message: formattedMessage
       })
     }
     resolve()
   } catch (e) {
     reject()
   }
 })
開發者ID:tic40,項目名稱:archives,代碼行數:31,代碼來源:chatbox.ts

示例10: Promise

 return new Promise(async (resolve, reject) => {
   try {
     const dnaList = await WordpressApi.fetchDNAList(
       Constants.NUMBER_OF_DNA_MATERIAL,
       1
     )
     let dnaMaterialList: Array<any> = []
     for (let i in dnaList) {
       if (typeof dnaList[i] !== 'undefined') {
         let dna = dnaList[i]
         let date: string = Moment(dnaList[i]['date']).format('YYYY/MM/DD')
         dnaMaterialList.push({
           id: dna['id'],
           number: undefined,
           jp_title: date + ' ' + dna['title']['rendered'],
           en_title: dna['title']['rendered'],
           url_student: 'https://www.tic40.com' + dna['link'],
           // DNA link for tutor
           url_tutor: 'https://www.tic40.com.ph' + dna['link']
         })
       }
     }
     materialCategoryDNA.material_list = dnaMaterialList
     resolve(materialCategoryDNA)
   } catch (e) {
     reject()
   }
 })
開發者ID:tic40,項目名稱:archives,代碼行數:28,代碼來源:material.ts


注:本文中的moment-timezone類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。