• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript moment-timezone类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript morgan类代码示例发布时间:2022-05-28
下一篇:
TypeScript moment类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap