当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript moment类代码示例

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


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

示例1: it

 it('should update the date to one month ago', () => {
     datepicker.open();
     let oneMonthAgo = moment().subtract(1, 'months').format(isoFormat);
     datepicker.date = oneMonthAgo;
     expect(datepicker.date).to.eventually.eql(oneMonthAgo);
 });
开发者ID:Droogans,项目名称:encore-ui,代码行数:6,代码来源:rxDatePicker.exercise.ts

示例2: it

 it('should initialize properly', () => {
     expect(moment().isSame(dp.now, 'day')).toBeTruthy();
     expect(dp._baseMonth).toEqual(moment().month());
     expect(dp.hideComponent).toBe(true);
 });
开发者ID:gabyvs,项目名称:ng2-ue-utils,代码行数:5,代码来源:datepicker.spec.ts

示例3: transform

 transform(value: string, formatFrom: string, formatTo: string = 'DD.MM.YYYY'): string {
   return moment(value, formatFrom).format(formatTo);
 }
开发者ID:EAgaragimow,项目名称:home-money,代码行数:3,代码来源:moment.pipe.ts

示例4: getMoment

 function getMoment(culture: string, value: any, format: string | undefined) {
     return culture ? localField(moment(value, format))(culture) : moment(value, format);
 }
开发者ID:AlejandroCano,项目名称:framework,代码行数:3,代码来源:ConfigureReactWidgets.ts

示例5: function

 m.smartNow = function () { return moment(); };
开发者ID:AlejandroCano,项目名称:framework,代码行数:1,代码来源:ConfigureReactWidgets.ts

示例6: transform

    transform(value: number, args: string[]) : any {
		var date = moment(value).locale('de').fromNow()+' : '+moment(value).locale('de').format('dddd, Do MMMM ');
        return date;
    }
开发者ID:Bitfroest,项目名称:CopterLeague,代码行数:4,代码来源:iso8601.pipe.ts

示例7: format

 function format(value: string | Date, format='YYYY-MM-DD HH:mm'): string {
   return moment(value).format(format);
 }
开发者ID:7125messi,项目名称:jupyterlab,代码行数:3,代码来源:time.ts

示例8: getResults

 public async getResults(id: number, dateFrom?: Date, dateTo?: Date) {
     return await this.httpClient.get<ICheckResults>("/api/results/" + id.toString()
         + (typeof dateFrom !== "undefined" ? "/" + moment(dateFrom).format("YYYY-MM-DD") : "")
         + (typeof dateTo !== "undefined" ? "/" + moment(dateTo).format("YYYY-MM-DD") : "")).pipe(first()).toPromise();
 }
开发者ID:MattJeanes,项目名称:SystemChecker,代码行数:5,代码来源:app.service.ts

示例9: moment

 @Transform(value => moment(value), { since: 1, until: 2 })
开发者ID:MagnusCloudCorp,项目名称:class-transformer,代码行数:1,代码来源:custom-transform.spec.ts

示例10: getConnection

                return getConnection().then(connection => {
                    ApplicationModel.setConnection(connection);
                    ApplicationBasicinfoModel.setConnection(connection);

                    let beforeId, afterId;
                    return new ApplicationModel({
                        agencyCode: 'agencyCode',
                        cscId: 'cscId',
                        applyType: 'applyType',
                        type: 'type',
                        submitType: 'st',
                        dispacth: 'dispacth',
                        dispacthProject: 'dp',
                        projectAttr: 'pa',
                        projectType: 'pt',
                        projectName: 'pn',
                        candidateType: 'candidateType',
                        remark1: 'remark1',
                        remark2: 'remark2',
                        remark3: 'remark3',
                        remark4: 'remark4',
                        status: 'status',
                        statusUpdateAt: m(),
                        createBy: 'createBy',
                        createAt: m(),
                        updateBy: 'updateBy',
                        updateAt: m()
                    }).save().then(_application => {
                        let id = _application.id;
                        beforeId = _application.id;
                        return new ApplicationBasicinfoModel({
                            id,
                            firstname: 'firstname',
                            lastname: 'lastname',
                            fullname: 'f l',
                            chineseName: 'chineseName',
                            gender: 'gender',
                            birthday: m(),
                            maritalStatus: 'maritalStatus',
                            nationality: 'n',
                            passportCode: 'passportCode',
                            nativeLanguage: 'nl',
                            religion: 'religion',
                            birthCountry: 'birthCountry',
                            birthCity: 'birthCity',
                            permanentTel: 'permanentTel',
                            permanentFax: 'permanentFax',
                            permanentEmail: 'permanentEmail',
                            permanentAddress: 'permanentAddress',
                            presentTel: 'presentTel',
                            presentFax: 'presentFax',
                            presentEmail: 'presentEmail',
                            presentAddress: 'presentAddress',
                            passportDeadline: m(),
                        }).save();

                        // _application.cscId = 'CSCiD';
                        // return _application.save();
                    }).then(_basicinfo => {
                        _basicinfo.gender = 'GENdER';
                        return _basicinfo.save();
                    }).then(_basicinfo => {
                        afterId = _basicinfo.id;
                        assert(_basicinfo.gender, 'GENdER');
                        assert.equal(beforeId, afterId);
                        return connection;
                    });
                }).then(connection => connection.release());
开发者ID:wangxin0709,项目名称:csc-scms-node-koa,代码行数:68,代码来源:application-basicinfo-model.ts


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