Adding a UCUM 'mo' or 'a' to a Date or DateTime returns a value instead of an error

未关闭
#408 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript
领域
backend

调研方向

The bug is in how cql-execution adds and subtracts definite-duration UCUM units ('mo', 'a') to Date and DateTime values; the spec requires an error there while 'wk' is allowed. Start by finding the date/time Add and Subtract implementations in the library's source and the Quantity-to-duration conversion they call, then reproduce the three table rows in a small script. Done when the 'mo' and 'a' cases throw an error and 'wk' still returns the expected date, with tests covering both.

由索引模型根据 Issue 内容生成。

描述

Summary

Add for date and time values (1.5.3 and 2.0):

However, to avoid the potential confusion of calendar-based date and time arithmetic with definite-duration date and time arithmetic, it is an error to attempt to add a definite-duration time-valued unit above days (and weeks), a calendar duration must be used.

UCUM 'mo' and 'a' are definite-duration units. The calendar units are month and year. Subtract says the same.

Expression cql-execution Spec Java engine 5.8.0
@2014-01-01 + 1 'mo' @2014-02-01 error error
@2014-01-01T10:00 + 1 'a' @2015-01-01T10:00 error error
@2014-01-01 + 1 'wk' @2014-01-08 @2014-01-08 (allowed)

Environment

cql-execution master e8096c6, through test-server (the build has two unrelated Quantity modulo commits on top). The Java engine column is HAPI FHIR 9.0.0 with clinical-reasoning 4.17.0, through $cql.

主要语言
JavaScript
星标
86
派生
40
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cqframework/cql-execution 的其他 Issue

查看 cqframework/cql-execution 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。