I am using <Statistic.Countdown /> from Ant design to display the dates.
I'd like to achieve a format like: "2 years, 4 months, 5 days HH:mm:ss"
I have format={"M months D HH:mm:ss"}, but of course this interprets the "m" in months as the symbol for minutes, and so on: 3 42onth36 25 17:42:36.
How could I achieve "3 months 25 days 17:42:36"?
Edit: Thanks to Samathingamajig I got this working. Now I'm wondering, how can I insert a newline? I tried the following, but of course the second line will just show the full countdown in HH:mm:ss
<Countdown title="Countdown" value={date} format={"M [months] D [days]"}/>
<Countdown title="" value={date} format={"HH:mm:ss"}/>
I've tried using \n and <br>, both plain and enclosed in square brackets, to no effect.
CodePudding user response:
If you look at the docs, it formats it the same as moment.js, and if you go to their documentation, you escape parts of the string with [ and ]
format={"M [months] D HH:mm:ss"}
https://codesandbox.io/s/countdown-antd-4-18-5-forked-soh98
CodePudding user response:
Try with single quotes like:
format={"M 'months' D HH:mm:ss"}
