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

TypeScript moment.unix函数代码示例

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

本文整理汇总了TypeScript中moment.unix函数的典型用法代码示例。如果您正苦于以下问题:TypeScript unix函数的具体用法?TypeScript unix怎么用?TypeScript unix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unix函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: findPrePostEvent

 private findPrePostEvent(event: Event) {
   if (moment.unix(event.startDate).isAfter()) {
     this.preEvent = true;
   } else if (moment.unix(event.startDate).isBefore(moment().subtract(1, 'day'))) {
     this.preEvent = false;
   } else if (moment.unix(event.startDate).isSameOrAfter(moment().subtract(1, 'day'))){
       this.preEvent = null;
   }
 }
开发者ID:marenwoodruff,项目名称:m2,代码行数:9,代码来源:surveys.component.ts


示例2: RegExp

 currentw => {
   this.icon = currentw.weather.replace(new RegExp(' ', 'g'), '').toLowerCase();
   if (this.icon === 'haze' || this.icon === 'clear') this.icon = 'cloud';
   this.city = currentw.display_location.full;
   this.temp = currentw.temp_c;
   this.description = currentw.weather;
   this.feelsLike = currentw.feelslike_c;
   this.lastUpdated = moment.unix(currentw.observation_epoch).fromNow();
 },
开发者ID:bryongloden,项目名称:rumpel,代码行数:9,代码来源:tile-weather.component.ts


示例3:

 .map((item) => {
     return {
         time: moment.unix(item.time).toDate(),
         temperature: Math.round(item.temperature),
         humidity: item.humidity * 100,
         precipProbability: Math.round(item.precipProbability * 100),
         precipIntensity: this._round(item.precipIntensity * (this.get("unitSystem") === "us" ? 25.4 : 1) , 2)// in/hr is a very small number so we convert to mm/h
     };
 });
开发者ID:PeterStaev,项目名称:tangra-weather-app,代码行数:9,代码来源:weather-dashboard-model.ts


示例4: findPreEvent

 private findPreEvent(event:Event) {
   if (moment.unix(event.startDate).isSameOrAfter() && this.survey) {
     this.preEvent = true;
     this.preEventSurvey(this.survey);
   } else {
     this.preEvent = false;
     this.postEventSurvey(this.survey);
   }
 }
开发者ID:marenwoodruff,项目名称:m2,代码行数:9,代码来源:event.component.ts


示例5: getMoment

export function getMoment(date: MomentInput, options: ExtenderOptions): Moment {
    if (options.unix) {
        return moment.unix(date as number);
    }
    else if (options.utc) {
        return moment.utc(date, options.format);
    }
    else {
        return moment(date, options.format);
    }
}
开发者ID:spatools,项目名称:komoment,代码行数:11,代码来源:core.ts


示例6: loadWeatherData

    public loadWeatherData() {
        let data = this._rawWeatherData;
        let unitSystem = this.get("unitSystem");
        let currentConditionIcon: ICurrentConditionIcon = currentConditionIcons[data.currently.icon];
        let unitSymbol: IUnitSymbol = units[unitSystem];
        let currentDailyData = data.daily.data[0];
        let reverseGeocodeResult = this._rawAddressData.results[0];
        let cityComponent = reverseGeocodeResult.address_components.filter((item) => item.types.indexOf("locality") !== -1);

        this.set("city", (cityComponent.length > 0 ? cityComponent[0].long_name : reverseGeocodeResult.formatted_address));        
        this.set("currentCondition", data.currently.icon);
        if (currentConditionIcon) {
            this.set("conditionIcon1Text", currentConditionIcon.icon1.text);
            this.set("conditionIcon1Color", currentConditionIcon.icon1.color);
            this.set("conditionIcon2Text", currentConditionIcon.icon2.text);
            this.set("conditionIcon2Color", currentConditionIcon.icon2.color);
            this.set("conditionFontSize", currentConditionIcon.fontSize);
        }
        this.set("currentTemperature", Math.round(data.currently.temperature));
        this.set("currentConditionSummary", data.currently.summary);
        this.set("currentHumidity", `${Math.round(data.currently.humidity * 100)} %`);
        this.set("currentPressure", `${data.currently.pressure} ${unitSymbol.pressure}`);
        this.set("currentWindSpeed", `${data.currently.windSpeed} ${unitSymbol.windSpeed}`);
        this.set("currentWindBearing", data.currently.windBearing);
        this.set("sunriseTime", moment.unix(currentDailyData.sunriseTime).toDate());
        this.set("sunsetTime", moment.unix(currentDailyData.sunsetTime).toDate());
        this.set("moonPhaseText", this._getMoonPhaseText(currentDailyData.moonPhase));
        this.set("moonPhaseIcon", String.fromCharCode(61589 + Math.round(28 * currentDailyData.moonPhase)));
        this.set("daily", data.daily.data.map((item) => {
            return {
                day: moment.unix(item.time).toDate(),
                temperatureMin: Math.round(item.temperatureMin),
                temperatureMax: Math.round(item.temperatureMax),
                icon: conditionIcons[item.icon],
                humidity: item.humidity * 100,
                precipProbability: Math.round(item.precipProbability * 100),
                precipIntensity: this._round(item.precipIntensity * (unitSystem === "us" ? 25.4 : 1), 2) // in/hr is a very small number so we convert to mm/h
            };
        }));
    }
开发者ID:PeterStaev,项目名称:tangra-weather-app,代码行数:40,代码来源:weather-dashboard-model.ts


示例7: getPostByAlias

export async function getPostByAlias(post_alias: string): Promise<Post> {
    var client: Client = await getClient();
    var resultSet: QueryResult = await client.query(`
            SELECT post.*, array_agg(post_label.post_label) AS post_labels
            FROM post
            LEFT JOIN post_label ON post_label.post_id = post.post_id 
            WHERE post.post_alias = $1
            GROUP BY post.post_id
        `, [post_alias]);

    if (resultSet.rows.length == 0) {
        throw new Error(`Post ${post_alias} not found.`);
    }

    var obj: any = resultSet.rows.pop();
    obj.post_date = moment.unix(obj.post_date).format("MMM DD, YYYY");
    return new Post(obj);
}
开发者ID:nicholas-robson,项目名称:dkydev_webapp,代码行数:18,代码来源:post.ts


示例8: createTimeCell

function createTimeCell(id: number, time: number): HTMLTableDataCellElement {
    const momentTime = moment.unix(time);
    const tid = "time-cell-" + id;
    const main = document.createElement("div");
    const isADayOld = momentTime.isBefore(moment().startOf('day'));
    main.textContent = momentTime.format(isADayOld ? 'MMM DD HH:mm:ss' : 'HH:mm:ss');
    main.id = tid;

    const tooltip = document.createElement("div");
    tooltip.textContent = momentTime.format('MMM DD YYYY, HH:mm:ss [UTC]ZZ');
    tooltip.setAttribute("data-mdl-for", tid);
    tooltip.classList.add("mdl-tooltip", "mdl-tooltip--large");

    const c = document.createElement("td");
    c.appendChild(main);
    c.appendChild(tooltip);

    return c;
}
开发者ID:Kashomon,项目名称:test-infra,代码行数:19,代码来源:prow.ts


示例9: if

      .find(y => {

        /** * * * * * * * * * * * * * * * * * * * * * * *
         * Temp - start (ideally would be refactored)
         * * * * * * * * * * * * * * * * * * * * * * * **/
        let thisItem;
        if (y === 'aM/PM') {
          if (item['meridian'] === 'Morning') {
            thisItem = 'AM';
          } else if (item['meridian'] === 'Evening') {
            thisItem = 'PM';
          }
        } else if (y === 'years') {
          thisItem = `${moment.unix(item['unix']).year()}`;
        } else {
          thisItem = item[y];
        }
        /** * * * * * * * * * * * * * * * * * * * * * * *
         * Temp - end
         * * * * * * * * * * * * * * * * * * * * * * * **/

        return this.flatArray(thisItem).indexOf(meta.input[y]) === -1;
      })
开发者ID:adriancarriger,项目名称:pv-site,代码行数:23,代码来源:filter.pipe.ts



注:本文中的moment.unix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript moment.updateLocale函数代码示例发布时间:2022-05-25
下一篇:
TypeScript moment.tz函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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