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);
 });
Example #2
0
 it('should initialize properly', () => {
     expect(moment().isSame(dp.now, 'day')).toBeTruthy();
     expect(dp._baseMonth).toEqual(moment().month());
     expect(dp.hideComponent).toBe(true);
 });
Example #3
0
 transform(value: string, formatFrom: string, formatTo: string = 'DD.MM.YYYY'): string {
   return moment(value, formatFrom).format(formatTo);
 }
 function getMoment(culture: string, value: any, format: string | undefined) {
     return culture ? localField(moment(value, format))(culture) : moment(value, format);
 }
 m.smartNow = function () { return moment(); };
Example #6
0
    transform(value: number, args: string[]) : any {
		var date = moment(value).locale('de').fromNow()+' : '+moment(value).locale('de').format('dddd, Do MMMM ');
        return date;
    }
Example #7
0
 function format(value: string | Date, format='YYYY-MM-DD HH:mm'): string {
   return moment(value).format(format);
 }
Example #8
0
 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();
 }
                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());
 @Transform(value => moment(value), { since: 1, until: 2 })