Unset date property
chapterjason opened this issue · comments
chapterjason commented
Currently, it isn't possible to unset a date property.
Making it a pointer works.
Line 110 in 24b668e
I've created a small workaround that works:
type EmptyDateProperty struct {
ID notionapi.ObjectID `json:"id,omitempty"`
Type notionapi.PropertyType `json:"type,omitempty"`
Date *notionapi.DateObject `json:"date"`
}
func (p EmptyDateProperty) GetType() notionapi.PropertyType {
return p.Type
}
// [...]
updates["Completed At"] = &EmptyDateProperty{
ID: completedAtProperty.ID,
Type: completedAtProperty.Type,
Date: nil,
}
// [...]
Anatoly Nosov commented
Hi, @chapterjason !
Could you please provide an example use case where EmptyProperty is needed?
chapterjason commented
Hey @jomei
Sure,, I have a small task board with the following properties
- Choice
State
with the valuesBlocked
,In Progress
andDone
- Date
Completed At
I've built a daemon which sets makest the following changes:
- if
state == "Done" && completedAt == nil
setCompleted At
to now - if
state != "Done" && completedAt != nil
setCompleted At
to empty or clear as it is called in the UI of notion.