Day
Day-of-month value object.
Import
typescript
import { Day } from '@haskou/value-objects';Signature
typescript
class Day extends IntegerConstructor
typescript
constructor(value: number | NumberValueObject)Validation
Must be between 1 and 31, inclusive.
Throws
This class can throw:
InvalidDayError
Example
typescript
import { Day } from '@haskou/value-objects';
const day = new Day(23);
day.valueOf(); // 23Notes
- It does not know which month it belongs to.
31is valid even for months that do not have 31 days.