I am looking for a way to add an extra word between the date and time in date-fns
library, but couldn't find such format. Right now I am using format
function with "MMM d hh:mm aa"
format. The outcome is:
Nov 15 10:00 PM
Is there a way to get:
Nov 15 at 10:00 PM
CodePudding user response:
I'd highly recommend reading and understanding the docs, before posting a question as simple as this.
As per documentation for the latest version (as of writing 2.29.3
) the following will yield the required result.
format(new Date("Sep 2 2020 13:00"), "MMM dd 'at' HH:MM a")
CodePudding user response:
You could format the lefthand and righthand part. Then do ${format(…)} at ${format(…)}
and concatenate the two with whatever word you'd like to put in between.