display day and month, without a year according to locale

前端 未结 4 605
灰色年华
灰色年华 2020-12-12 03:17

Is there any better way for getting only day and month from a date including location appropriate separator?

I have a solution that gets separator first:

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 03:49

    You can try the regex below and check if it works for you.I tried with different locale it was working as expeted

    dateFormat.replace(/Y/ig, '  ').replace(/^\W{1,}|\W{1,}$|\W{3,3}/, '');
    

提交回复
热议问题