Date attribute
Attribute type id | Type specific restriction parameters |
---|---|
date | format: Date-time format. If not provided default format is: "yyyy-MM-dd" |
All restrictions are validated in provided order. Attribute validation will fail on the first unfulfilled restriction.
Notice that API accepts SimpleDateFormat as a format specification so it is possible to define date-time pattern including time.
Code Examples:
{
"id" : "DELIVERY_DATE",
"name" : "Delivery date",
"type" : {
"id" : "date",
"restriction" : {
"parameters" : {
"format" : "M/d/yy"
}
}
}
},
{
"id" : "AVAILABILITY_START_DATE_TIME",
"name" : "Start availability date time",
"type" : {
"id" : "date",
"restriction" : {
"parameters" : {
"format" : "dd-MM-yyyy HH:mm:ss"
}
}
}
}
Attribute deliveryDate = AttributeBuilder
.dateAttribute("DELIVERY_DATE", "Delivery date")
.withFormat(new SimpleDateFormat("M/d/yy"))
.build();
Attribute availabilityStartDateTime = AttributeBuilder
.dateAttribute("AVAILABILITY_START_DATE_TIME", "Start availability date time")
.withFormat(new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"))
.build();
Updated over 1 year ago