當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。