InseeFr / Trevas

Transformation engine and validator for statistics.
MIT License
9 stars 5 forks source link

Introduce the new temporal types #317

Closed hadrienk closed 1 month ago

hadrienk commented 3 months ago

Using the threeten-extra (additional date-time classes that complement those in Java SE 8.) the mapping can be as follow:

date -> java.time.Instant time_period -> Interval duration -> PeriodDuration

This simplify the parsing of ISO_8601 format.

Test case:

d1 := cast("P1Y2M10DT2H30M", duration);
d2 := cast("P1Y15M2DT086401S", duration);
p1 := cast("2015-03-03T09:30:45Z/2018-04-05T12:30:15Z", time_period);
p2 := cast("2007-03-01T13:00:00Z/P1Y2M10DT2H30M", time_period);
p3 := cast("P1Y2M10DT2H30M/2008-05-11T15:30:00Z", time_period);

The truncated representation of period is left unimplemented as it seems to be deprecated

p3 := cast("P1Y2M10DT2H30M/2008-05-11T15:30:00Z", time_period);
sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
62.2% Coverage on New Code (required ≥ 80%)
4.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud