Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sample.cv.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"description": "AI-powered data optimization company",
"position": "Senior Engineering Manager",
"url": "http://nucleuslabs.example.com",
"startDate": "2023-01",
"startDate": "2023",
"endDate": null,
"summary": "Currently leading a team of engineers developing next-generation AI algorithms for data compression and optimization.",
"highlights": [
Expand Down Expand Up @@ -115,7 +115,7 @@
"url": "https://www.ou.edu/",
"area": "Information Technology",
"studyType": "Bachelor",
"startDate": "2011-06-01",
"startDate": "2011",
"endDate": "2014-01-01",
"score": "4.0",
"courses": [
Expand All @@ -140,7 +140,7 @@
"awards": [
{
"title": "Digital Compression Pioneer Award",
"date": "2014-11-01",
"date": "2014",
"awarder": "Techcrunch",
"summary": "There is no spoon."
},
Expand All @@ -155,7 +155,7 @@
{
"name": "Video compression for 3d media",
"publisher": "Hooli",
"releaseDate": "2014-10-01",
"releaseDate": "2014-10",
"url": "http://en.wikipedia.org/wiki/Silicon_Valley_(TV_series)",
"summary": "Innovative middle-out compression algorithm that changes the way we store data."
},
Expand Down
42 changes: 36 additions & 6 deletions src/themes/reorx/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,28 @@ function dateRange(item, level) {
break;
}
if (format) {
startDate = startDate ? fn.reformatDate(startDate, format) : ''
endDate = endDate ? fn.reformatDate(endDate, format) : ''
// Handle YYYY-only and YYYY-MM dates
if (startDate && /^\d{4}$/.test(startDate)) {
// YYYY format - return as-is
startDate = startDate
} else if (startDate && /^\d{4}-\d{2}$/.test(startDate)) {
// YYYY-MM format - format as MMM YYYY
startDate = fn.reformatDate(startDate, 'MMM YYYY')
} else {
// Other formats (YYYY-MM-DD, etc.)
startDate = startDate ? fn.reformatDate(startDate, format) : ''
}

if (endDate && /^\d{4}$/.test(endDate)) {
// YYYY format - return as-is
endDate = endDate
} else if (endDate && /^\d{4}-\d{2}$/.test(endDate)) {
// YYYY-MM format - format as MMM YYYY
endDate = fn.reformatDate(endDate, 'MMM YYYY')
} else {
// Other formats (YYYY-MM-DD, etc.)
endDate = endDate ? fn.reformatDate(endDate, format) : ''
}
}
let result = ''
if (startDate && endDate) {
Expand All @@ -49,8 +69,8 @@ function dateRange(item, level) {
%>

<%
function date(item, level) {
let {date} = item
function date(item, level, fieldName = 'date') {
let date = item[fieldName]
if (!date) return ''
let format
// level: 1: year, 2: month, 3: day
Expand All @@ -63,7 +83,17 @@ function date(item, level) {
break;
}
if (format) {
date = date ? fn.reformatDate(date, format) : ''
// Handle YYYY-only and YYYY-MM dates
if (/^\d{4}$/.test(date)) {
// YYYY format - return as-is
date = date
} else if (/^\d{4}-\d{2}$/.test(date)) {
// YYYY-MM format - format as MMM YYYY
date = fn.reformatDate(date, 'MMM YYYY')
} else {
// Other formats (YYYY-MM-DD, etc.)
date = date ? fn.reformatDate(date, format) : ''
}
}
return `<div class="date-range">${date}</div>`
}
Expand Down Expand Up @@ -382,7 +412,7 @@ function date(item, level) {
<div class="publication section-item">
<div class="row space-between">
<h3><%= item.name %></h3>
<%- date(item, 2) %>
<%- date(item, 2, 'releaseDate') %>
</div>
<div class="publisher row subtitle"><%= item.publisher %></div>
<%- linkInDiv(item.url) %>
Expand Down