Last active
June 19, 2024 16:03
-
-
Save xardit/2eb9f5584fc7d8045982d6ded68407f0 to your computer and use it in GitHub Desktop.
month2sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const month2sq = { | |
January: 'Janar', | |
February: 'Shkurt', | |
March: 'Mars', | |
April: 'Prill', | |
May: 'Maj', | |
June: 'Qershor', | |
July: 'Korrik', | |
August: 'Gusht', | |
September: 'Shtator', | |
October: 'Tetor', | |
November: 'Nëntor', | |
December: 'Dhjetor', | |
} | |
export function formatDate(date) { | |
let str = new Date(date).toLocaleString('sq', { day: 'numeric', month: 'long', year: 'numeric' }) | |
for (const enMonth in month2sq) { | |
str = str.replace(enMonth, month2sq[enMonth]) | |
} | |
return capitalizeEachWord(str) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment