Skip to content

Commit

Permalink
work experience
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigorii Bushmanov authored and Grigorii Bushmanov committed Jul 20, 2023
1 parent b9c4cd6 commit fd617ca
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 43 deletions.
83 changes: 43 additions & 40 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ var fs = require('fs');
var _ = require('lodash');
var gravatar = require('gravatar');
var Mustache = require('mustache');
var formatDuration = require('date-fns/formatDuration');
var differenceInMonths = require('date-fns/differenceInMonths');
var startOfMonth = require('date-fns/startOfMonth');
var endOfMonth = require('date-fns/endOfMonth');
var addDays = require('date-fns/addDays');

var d = new Date();
var curyear = d.getFullYear();
Expand Down Expand Up @@ -109,52 +114,50 @@ function render(resumeObject) {
}
});

if (resumeObject.work && resumeObject.work.length) {
resumeObject.workBool = true;
_.each(resumeObject.work, function(w){
if (w.startDate) {
w.startDateYear = (w.startDate || "").substr(0,4);
w.startDateMonth = getMonth(w.startDate || "");

}
if(w.endDate) {
w.endDateYear = (w.endDate || "").substr(0,4);
w.endDateMonth = getMonth(w.endDate || "");
} else {
w.endDateYear = 'Present'
}
if (w.highlights) {
if (w.highlights[0]) {
if (w.highlights[0] != "") {
w.boolHighlights = true;
}
function handleWorkplace(w) {
const { startDate, endDate } = w;
if (startDate) {
w.startDateYear = (startDate || "").substr(0,4);
w.startDateMonth = getMonth(startDate || "");
}
if(endDate) {
w.endDateYear = (endDate || "").substr(0,4);
w.endDateMonth = getMonth(endDate || "");
} else {
w.endDateYear = 'Present'
}
if (w.highlights) {
if (w.highlights[0]) {
if (w.highlights[0] != "") {
w.boolHighlights = true;
}
}
});
}
if (startDate) {
const months = differenceInMonths(
addDays(endOfMonth(new Date(endDate)), 1),
startOfMonth(new Date(startDate))
);
w.workExperience = formatDuration(
{
years: Math.floor(months / 12),
months: months % 12,
},
{
format: ["years", "months"],
}
);
}
}

if (resumeObject.work && resumeObject.work.length) {
resumeObject.workBool = true;
_.each(resumeObject.work, handleWorkplace);
}

if (resumeObject.volunteer && resumeObject.volunteer.length) {
resumeObject.volunteerBool = true;
_.each(resumeObject.volunteer, function(w){
if (w.startDate) {
w.startDateYear = (w.startDate || "").substr(0,4);
w.startDateMonth = getMonth(w.startDate || "");

}
if(w.endDate) {
w.endDateYear = (w.endDate || "").substr(0,4);
w.endDateMonth = getMonth(w.endDate || "");
} else {
w.endDateYear = 'Present'
}
if (w.highlights) {
if (w.highlights[0]) {
if (w.highlights[0] != "") {
w.boolHighlights = true;
}
}
}
});
_.each(resumeObject.volunteer, handleWorkplace);
}

if (resumeObject.projects && resumeObject.projects.length) {
Expand Down
53 changes: 53 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonresume-theme-kendall",
"version": "0.2.0",
"version": "0.2.1",
"description": "A JSON Resume theme built with bootstrap",
"main": "index.js",
"scripts": {
Expand All @@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"check-url-type": "^1.0.1",
"date-fns": "^2.30.0",
"gravatar": "^1.0.6",
"lodash": "^4.17.20",
"mustache": "^2.2.1",
Expand Down
4 changes: 2 additions & 2 deletions resume.template
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<a href="{{url}}" target= "_blank"><i class="fas fa-globe ico"></i> {{url}}</a>
</div>
{{/url}}
<div class="year">{{startDateMonth}}{{startDateYear}} – {{endDateMonth}}{{endDateYear}}</div>
<div class="year">{{startDateMonth}}{{startDateYear}} – {{endDateMonth}}{{endDateYear}}, {{workExperience}}</div>
</div>
</div>
<div class="row">
Expand Down Expand Up @@ -126,7 +126,7 @@
<a href="{{url}}" target= "_blank"><i class="fas fa-globe ico"></i> {{url}}</a>
</div>
{{/url}}
<div class="year">{{startDateMonth}}{{startDateYear}} – {{endDateMonth}}{{endDateYear}}</div>
<div class="year">{{startDateMonth}}{{startDateYear}} – {{endDateMonth}}{{endDateYear}}, {{workExperience}}</div>
</div>
</div>
<div class="row">
Expand Down

0 comments on commit fd617ca

Please sign in to comment.