I've written a todo handler API and want to add a condition to check if inputted DueDate by user is less than tomorrow date,how should I write it instead of ???? in following code?
type Todo struct {
gorm.Model
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
DueDate time.Time `json:"duedate,omitempty"`
UserId uint `json:"user_id"` //The user that this todo belongs to
}
func ValidateTodo(todo *Todo) (map[string]interface{}, bool) {
if todo.Title == "" {
return u.Message(false, "Todo title should be on the payload"), false
}
if len(todo.Title)>30 {
return u.Message(false, "Todo title should be less than 30 characters"), false
}
if todo.Description == "" {
return u.Message(false, "Todo description should be on the payload"), false
}
if todo.DueDate<time.Now(){
?????
}
return u.Message(true, "success"), true
}