Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yearless dates are valid HTML but flagged #775

Closed
robinwhittleton opened this issue Jul 2, 2017 · 4 comments
Closed

Yearless dates are valid HTML but flagged #775

robinwhittleton opened this issue Jul 2, 2017 · 4 comments
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: completed Work completed, can be closed type: bug The issue describes a bug
Milestone

Comments

@robinwhittleton
Copy link

HTML5.1 allows yearless dates, but epubcheck currently flags them. It looks like amending the current set of regexes in datatypes.rnc to include something like ([0-9]{2})-([0-9]{2}) would fix it but this is the first time I’ve looked at the code so I’ll defer unless this doesn’t get picked up.

(somewhat similar to #341)

@tofi86
Copy link
Collaborator

tofi86 commented Jul 2, 2017

AFAIK EPUB 3 specifies a specific HTML 5 subset which is not HTML 5.1 (am I right @mattgarrish?) and the newer HTML versions are only supported by EPUB 3.1 which however isn't supported by EpubCheck yet.

@tofi86 tofi86 added type: bug The issue describes a bug epub-3.1 labels Jul 2, 2017
@robinwhittleton
Copy link
Author

robinwhittleton commented Jul 2, 2017

Thanks for the reply. HTML5.0 also defines a yearless date format as valid for the datetime attribute, and it looks like EPUB 3.0 pretty much wholesale imports the W3C HTML5.0 spec (assuming XHTML serialisation)? Sorry if I’m getting this wrong, I’m new to EPUB stuff.

@mattgarrish
Copy link
Member

Looks like a bug. From what I see, there's no accounting for yearless dates in the date.or.time datatype. I wouldn't modify html.date as that looks like it would allow in input/date which requires a year from my reading. Probably need a new date type like:

datatype.html5.date.or.time = datatype.html5.date | datatype.html5.month | datatype.html5.yearless | datatype.html5.time | datatype.html5.datetime.global

datatype.html5.yearless = xsd:token { pattern ='(--)?(0[1-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[0-1])' }

(All the other date patterns use simple [0-9] ranges, so maybe the above is a bit of overkill since it will still allow bad dates.)

@tofi86 tofi86 removed the epub-3.1 label Jul 2, 2017
@tofi86 tofi86 added the status: ready for implem The issue is ready to be implemented label Nov 27, 2017
@rdeltour rdeltour added the spec: EPUB 3.2 Impacting the support of EPUB 3.2 label Jan 17, 2019
rdeltour pushed a commit that referenced this issue Jan 29, 2019
Updates the date/times/duration RelaxNG types to better align with the
HTML definitions:

- adds support for yearless dates, year-only dates, and durations for time/datetime
- allows a space in addition to 'T' for separating dates and times
- makes the colon optional in timezone offsets
- limits seconds to three digits after a period

Note: the handling of dates and times is much more limited in epubcheck
than HTML allows. Some checks can really only be programmed; this change
is more an interim step to future integration.

Fix #775
@rdeltour rdeltour added status: completed Work completed, can be closed and removed status: ready for implem The issue is ready to be implemented labels Jan 29, 2019
@rdeltour
Copy link
Member

Closed in #957

@rdeltour rdeltour added this to the 4.2.0-beta milestone Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: completed Work completed, can be closed type: bug The issue describes a bug
Projects
None yet
Development

No branches or pull requests

4 participants