Skip to content

Commit

Permalink
Handle unknown start/stop ISO dates in patch generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgolden committed Apr 20, 2015
1 parent 6cb9934 commit 54b76eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/templates/period.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@
<div class="field">
<dt>Start</dt>
<%
if (period.start.in.hasOwnProperty('earliestYear')) {
var startIn = period.start.in || {};
if (startIn.hasOwnProperty('earliestYear')) {
var startParsed = 'Earliest: ' + period.start.in.earliestYear + ', Latest: ' + period.start.in.latestYear;
} else if (period.start.in.hasOwnProperty('year')) {
} else if (startIn.hasOwnProperty('year')) {
var startParsed = period.start.in.year;
} else {
var startParsed = 'unknown';
Expand All @@ -74,9 +75,10 @@
<div class="field">
<dt>Stop</dt>
<%
if (period.stop.in.hasOwnProperty('earliestYear')) {
var stopIn = period.stop.in || {};
if (stopIn.hasOwnProperty('earliestYear')) {
var stopParsed = 'Earliest: ' + period.stop.in.earliestYear + ', Latest: ' + period.stop.in.latestYear;
} else if (period.stop.in.hasOwnProperty('year')) {
} else if (stopIn.hasOwnProperty('year')) {
var stopParsed = period.stop.in.year;
} else {
var stopParsed = 'unknown';
Expand Down

0 comments on commit 54b76eb

Please sign in to comment.