Getting datespanValue #8
-
Hi @zcohan, I'm currently evaluating Maybe you can point me to what I may be doing wrong? var customization = EngineCustomization.standard
customization.featureFlags.seeksFutureDate = true
customization.featureFlags.calendarCalculations = true
let calculator = Calculator(customization: customization)
let values = calculator.dateFor("3-4 march") // As per sample given in code base
let dateSpan = values?.result.evaluationResult.datespanValue
print(dateSpan) // => nil Thanks, Leo |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @leotumwattana, The As a workaround in the meantime you can also get the datespan from the parsed expression: |
Beta Was this translation helpful? Give feedback.
-
Hi @zcohan, Thanks for your quick reply. Adding datespan to However, it seems there are a few cases where the datespan parsing is having some issues: let datespan = calculator.calculate("March 3 5pm-6pm").parsedExpression?.firstToken(ofType: .datespan)?.datespanValue
// Result: "Mar 3, 2005 at 12:00 PM" - "Mar 6, 2005 at 12:00 PM"
// Expected: "Mar 3, 2024 5pm" - "Mar 3, 2024 6pm" let datespan = calculator.calculate("March 3 5pm for 2 hours").parsedExpression?.firstToken(ofType: .datespan)?.datespanValue
// Result: nil
// Expected: "Mar 3, 2024 5pm" - "Mar 3, 2024 7pm" |
Beta Was this translation helpful? Give feedback.
-
Try the new |
Beta Was this translation helpful? Give feedback.
Try the new
dateIntervalFor(_ expression: String) -> DateInterval?
onCalculator
in version3.0.0
.