Просмотр исходного кода

Revert "allows to add carbs in future"

This reverts commit f0ed313366c8f64f465641f401f1f5c476ba940e.

Reverted due to incompatibility with new bolus-meal which will need some refactoring first.
Jon B.M 2 лет назад
Родитель
Сommit
234c8edb41
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

+ 5 - 1
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -74,6 +74,7 @@ extension AddCarbs {
 
                     // Time
                     HStack {
+                        let now = Date.now
                         Text("Time")
                         Spacer()
                         if !pushed {
@@ -86,11 +87,14 @@ extension AddCarbs {
                             DatePicker(
                                 "Time",
                                 selection: $state.date,
+                                in: ...now,
                                 displayedComponents: [.hourAndMinute]
                             ).controlSize(.mini)
                                 .labelsHidden()
                             Button {
-                                state.date = state.date.addingTimeInterval(10.minutes.timeInterval)
+                                if state.date.addingTimeInterval(5.minutes.timeInterval) < now {
+                                    state.date = state.date.addingTimeInterval(10.minutes.timeInterval)
+                                }
                             }
                             label: { Image(systemName: "plus.circle") }.tint(.blue).buttonStyle(.borderless)
                         }