Support for HTML5 time element; option for lowercase dates #3

Merged
merged 2 commits into from Dec 21, 2011

Conversation

Projects
None yet
2 participants
@samatjain
Contributor

samatjain commented Dec 10, 2011

Support HTML5's time element (a preferred way to markup dates, which includes W3CTDF dates in the "datetime" attribute).

Also, add option to jQuery plugin to lowercase generated dates.

Unit tests included for both.

Sorry for adding 2 features in the same branch!

src/humane.js
+ if(typeof date === 'undefined')
+ return;
+
+ date = humaneDate(date);

This comment has been minimized.

@zachleat

zachleat Dec 10, 2011

Owner

Might be better as date = humanDate(date) || '';

Then we can eliminate the typeof comparison below.

@zachleat

zachleat Dec 10, 2011

Owner

Might be better as date = humanDate(date) || '';

Then we can eliminate the typeof comparison below.

This comment has been minimized.

@samatjain

samatjain Dec 12, 2011

Contributor

Agreed 100%.

@samatjain

samatjain Dec 12, 2011

Contributor

Agreed 100%.

src/humane.js
- date = humaneDate($t.attr('title'));
+ date = $t.attr('datetime') || $t.attr('title');
+
+ if(typeof date === 'undefined')

This comment has been minimized.

@zachleat

zachleat Dec 10, 2011

Owner

If(!date) should work here, no? typeof feels too restrictive. If the attributes exist but are empty strings, this will continue on its merry way.

@zachleat

zachleat Dec 10, 2011

Owner

If(!date) should work here, no? typeof feels too restrictive. If the attributes exist but are empty strings, this will continue on its merry way.

samatjain added some commits Dec 15, 2011

Support for HTML5 time element
Look for HTML5 time element's "datetime" attribute first, then "title"
attribute. Includes unit test.
Lowercase output option
Add option (at jQuery plugin level) to lowercase dates (default remains
title case). Includes unit test.
@samatjain

This comment has been minimized.

Show comment
Hide comment
@samatjain

samatjain Dec 15, 2011

Contributor

Re-did both commits w/ your suggestions. Let me know if you've further suggestions.

Contributor

samatjain commented Dec 15, 2011

Re-did both commits w/ your suggestions. Let me know if you've further suggestions.

zachleat added a commit that referenced this pull request Dec 21, 2011

Merge pull request #3 from samatjain/html5
Support for HTML5 time element; option for lowercase dates

@zachleat zachleat merged commit 2babe8b into zachleat:master Dec 21, 2011

@zachleat

This comment has been minimized.

Show comment
Hide comment
@zachleat

zachleat Dec 21, 2011

Owner

Looks great, thanks!!

Owner

zachleat commented Dec 21, 2011

Looks great, thanks!!

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