You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
479 B
23 lines
479 B
package value_objects |
|
|
|
import ( |
|
"time" |
|
) |
|
|
|
type ExpirationDate struct { |
|
value time.Time |
|
} |
|
|
|
func NewExpirationDate(value time.Time) (ExpirationDate, error) { |
|
// According to business rules, expired items can be added to the store, |
|
// so we don't need to validate if the date is in the past |
|
return ExpirationDate{value: value}, nil |
|
} |
|
|
|
func (e ExpirationDate) Time() time.Time { |
|
return e.value |
|
} |
|
|
|
func (e ExpirationDate) String() string { |
|
return e.value.Format(time.RFC3339) |
|
} |