Skip to content

Instantly share code, notes, and snippets.

@xardit
Last active June 19, 2024 16:03
Show Gist options
  • Save xardit/2eb9f5584fc7d8045982d6ded68407f0 to your computer and use it in GitHub Desktop.
Save xardit/2eb9f5584fc7d8045982d6ded68407f0 to your computer and use it in GitHub Desktop.
month2sq
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