File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,21 @@ import { work } from "@cv";
2222 },
2323 index ,
2424 ) => {
25- const startYear = new Date (startDate ).getFullYear ();
26- const endYear = endDate ? new Date (endDate ).getFullYear () : " Present" ;
2725 const isLastItem = index === work .length - 1 ;
2826
2927 const d1 = new Date (startDate );
3028 const d2 = endDate ? new Date (endDate ) : new Date ();
3129
30+ const dateOptions: Intl .DateTimeFormatOptions = {
31+ month: " short" ,
32+ year: " numeric" ,
33+ };
34+
35+ const formattedStartDate = d1 .toLocaleString (" en-US" , dateOptions );
36+ const formattedEndDate = endDate
37+ ? d2 .toLocaleString (" en-US" , dateOptions )
38+ : " Present" ;
39+
3240 let years = d2 .getFullYear () - d1 .getFullYear ();
3341 let months = d2 .getMonth () - d1 .getMonth ();
3442
@@ -59,9 +67,9 @@ import { work } from "@cv";
5967 { /* Datetime */ }
6068 <div class = " mt-1 text-xs font-bold text-black/50 dark:text-white/50" >
6169 <div >
62- <time datetime = { startDate } >{ startYear } </time >
70+ <time datetime = { startDate } >{ formattedStartDate } </time >
6371 <span class = " mx-1" >-</span >
64- <time datetime = { endDate } >{ endYear } </time >
72+ <time datetime = { endDate } >{ formattedEndDate } </time >
6573 </div >
6674 { duration && <div class = " font-normal" >{ duration } </div >}
6775 </div >
You can’t perform that action at this time.
0 commit comments