Skip to content

[PER-10481] Add EDTF date parsing service#963

Open
aasandei-vsp wants to merge 1 commit intomainfrom
PER-10481-edtf-service
Open

[PER-10481] Add EDTF date parsing service#963
aasandei-vsp wants to merge 1 commit intomainfrom
PER-10481-edtf-service

Conversation

@aasandei-vsp
Copy link
Contributor

This service is not exposed in any way yet, so it can't be tested. It is only validated atm by unit tests.

The only thing that might cause problems at build time would be the edtf package.

Issue: PER-10481

@aasandei-vsp
Copy link
Contributor Author

aasandei-vsp commented Mar 11, 2026

@slifty Do you think you could try and run this locally? I had some issues with installing the package locally as well and it seems the build fails on the PR too. Do you think you could have a look?

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 97.87234% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.15%. Comparing base (20919e1) to head (0e14719).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...c/app/shared/services/edtf-service/edtf.service.ts 97.87% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #963      +/-   ##
==========================================
+ Coverage   48.79%   49.15%   +0.35%     
==========================================
  Files         351      352       +1     
  Lines       11345    11439      +94     
  Branches     1899     1932      +33     
==========================================
+ Hits         5536     5623      +87     
- Misses       5619     5625       +6     
- Partials      190      191       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@slifty
Copy link
Contributor

slifty commented Mar 11, 2026

@aasandei-vsp I was able to run npm i locally (it did tweak the package-lock format, which I think is a byproduct of the recent lock format thrash in npm).

I'm on node 24.13.0 and npm 11.11.0


I haven't yet rebuilt docker, but wanted to give context to the "fix package lock" commit above which appears to at least fix CI.

@slifty
Copy link
Contributor

slifty commented Mar 11, 2026

Looks like the local issue was related to esm / cjs -- apparently the solution is to instruct vite to ignore it during the prebundle step (I admit that even still I'm not fully adept at the nuances of esm)

I put these as commits so you see 'em but really they should just be fixup'd into your original introduction of the lib

@aasandei-vsp aasandei-vsp force-pushed the PER-10481-edtf-service branch from a4b02b0 to 4ee2ce7 Compare March 12, 2026 12:02
… structured date/time models

Introduces EdtfService that handles parsing EDTF (Extended Date Time Format)
strings into structured DateTimeModel objects and converting them back. Supports
partial years, unspecified fields (XX), date qualifiers (approximate, uncertain),
date ranges/intervals, 12-hour AM/PM time conversion, and timezone extraction.
Includes validation methods for dates and times, along with comprehensive unit
tests and type declarations for the edtf npm package.

Issue: PER-10481
@aasandei-vsp aasandei-vsp force-pushed the PER-10481-edtf-service branch from 4ee2ce7 to 0e14719 Compare March 12, 2026 12:05
Copy link
Member

@cecilia-donnelly cecilia-donnelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so fancy, @aasandei-vsp ! I love it. Other than the unknown bit I flagged this looks correct. I can imagine finding other edge cases as we test, but you've organized this really clearly. Thank you!

const result = service.toDateTimeModel('1985-XX');

expect(result.qualifiers.unknown).toBe(true);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want unknown to be true here - I believe unknown is a fully null date.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this from "the extended interval syntax keywords 'unknown' and 'open' have been replaced with null and the double-dot notation ['..'] respectively; " on the spec.

}

return `${year}-${date.month}-${date.day}`;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this to return '2026-XX-XX' for something that happened in this year, not just '2026' -- am I misunderstanding? It looks like either is valid, though! "The character 'X' may be used in place of one or more rightmost digits to indicate that the value of that digit is unspecified" -- may so either works. Okay, no action needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants