本文整理汇总了TypeScript中forms/models/dateOfBirth.DateOfBirth类的典型用法代码示例。如果您正苦于以下问题:TypeScript DateOfBirth类的具体用法?TypeScript DateOfBirth怎么用?TypeScript DateOfBirth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateOfBirth类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deserialize
deserialize (input?: any): IndividualDetails {
if (input) {
Object.assign(this, new SplitNamedPartyDetails().deserialize(input))
this.type = PartyType.INDIVIDUAL.value
if (input.dateOfBirth) {
this.dateOfBirth = DateOfBirth.fromObject(input.dateOfBirth)
}
}
return this
}
示例2: it
it('should deserialize all fields', () => {
expect(DateOfBirth.fromObject({
known: 'true',
date: {
year: 2017,
month: 12,
day: 31
}
})).to.deep.equal(dateOfBirth(2017, 12, 31))
})
示例3: fromObject
static fromObject (input?: any): IndividualDetails {
if (input == null) {
return input
}
const deserialized = new IndividualDetails()
Object.assign(deserialized, SplitNamedPartyDetails.fromObject(input))
deserialized.type = PartyType.INDIVIDUAL.value
if (input.dateOfBirth) {
deserialized.dateOfBirth = DateOfBirth.fromObject(input.dateOfBirth)
}
return deserialized
}
示例4: it
it('should return true when there is a date', () => {
const dob: DateOfBirth = new DateOfBirth(true, new LocalDate(1981, 11, 11))
expect(dob.isCompleted()).to.equal(true)
})
示例5: isCompleted
isCompleted (...groups: string[]): boolean {
const dobComplete: boolean = groups.indexOf('claimant') !== -1 ? !!this.dateOfBirth && this.dateOfBirth.isCompleted() : true
return super.isCompleted(...groups) && dobComplete
}