Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react date component with word month

// Single-File-Component for React 
// Displays month as a word - format: December 31, 2021
export default function currentDate() {
  const current = new Date();

  const month = current.toLocaleString("default", { month: "long" });
  const date = `${month} ${current.getDate()}, ${current.getFullYear()}`;

  return <span>{date}</span>;
}
 
PREVIOUS NEXT
Tagged: #react #date #component #word #month
ADD COMMENT
Topic
Name
9+4 =