@burh/nuxt-core 1.0.161 → 1.0.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,7 @@
48
48
  <div
49
49
  v-show="userData.user_education.length > 0"
50
50
  class="education ml-3"
51
- v-for="(edu, index) in userData.user_education"
51
+ v-for="(edu, index) in filterByDate(userData.user_education, 'old')"
52
52
  :key="index"
53
53
  >
54
54
  <p class="sub-title">{{ edu.formation }}</p>
@@ -70,7 +70,7 @@
70
70
  <div
71
71
  v-show="userData.user_experience.length > 0"
72
72
  class="experience ml-3 mr-3"
73
- v-for="(exp, index) in userData.user_experience"
73
+ v-for="(exp, index) in filterByDate(userData.user_experience)"
74
74
  :key="`experience-${index}`"
75
75
  >
76
76
  <p class="sub-title">{{ exp.job_title }}</p>
@@ -105,7 +105,7 @@
105
105
  <div
106
106
  v-show="userData.user_course.length > 0"
107
107
  class="courses ml-3"
108
- v-for="(cou, index) in userData.user_course"
108
+ v-for="(cou, index) in filterByDate(userData.user_course, 'old')"
109
109
  :key="`course-${index}`"
110
110
  >
111
111
  <p class="sub-title">{{ cou.institution }}</p>
@@ -130,6 +130,45 @@ export default {
130
130
  }
131
131
  },
132
132
  methods: {
133
+ filterByDate(data, by = 'new') {
134
+ let sortedArray = data.sort((a, b) => {
135
+ a = [
136
+ a.start_month,
137
+ a.start_year,
138
+ a.end_month | 12,
139
+ a.end_year | 9999
140
+ ];
141
+
142
+ b = [
143
+ b.start_month,
144
+ b.start_year,
145
+ b.end_month | 12,
146
+ b.end_year | 9999
147
+ ];
148
+
149
+ // Primeiro filtro -> chaves: 0 e 1 -> Filtro por data de inicio
150
+ // Segundo filtro -> chaves: 2 e 3 -> Filtro por data de termino (subir não concluídos para primeiros)
151
+
152
+ let byStart;
153
+ let byEnd;
154
+
155
+ switch (by) {
156
+ case 'old':
157
+ byStart = (new Date(a[1], a[0], 1).getTime() - new Date(b[1], b[0], 1).getTime());
158
+ byEnd = (new Date(b[3], b[2], 1).getTime() - new Date(a[3], a[2], 1).getTime());
159
+ break;
160
+
161
+ default:
162
+ byStart = (new Date(b[1], b[0], 1).getTime() - new Date(a[1], a[0], 1).getTime());
163
+ byEnd = (new Date(b[3], b[2], 1).getTime() - new Date(a[3], a[2], 1).getTime());
164
+ break;
165
+ }
166
+
167
+ return (byStart - byEnd);
168
+ });
169
+
170
+ return sortedArray;
171
+ },
133
172
  toggleReadMore(event, id) {
134
173
  const element = document.getElementById(id);
135
174
  element.classList.toggle('readmore');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.161",
3
+ "version": "1.0.163",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {