【问题标题】:Display all remaining days in the current month in react js在反应js中显示当月所有剩余天数
【发布时间】:2021-06-05 18:15:23
【问题描述】:

如何在 react js / react-native 中显示当月的所有剩余天数? 它需要看起来像这样,我不需要 CSS 只需要 javascript 如何显示它:

【问题讨论】:

标签: javascript reactjs react-native frontend


【解决方案1】:
now = new Date();

// Tota number of days in current month
const totalDays = new Date(now.getFullYear(), now.getMonth()+1, 0).getDate();

// Today's day
const today = now.getDate();

// Remaining days of the month
const remainingDays = totalDays - today;

【讨论】:

  • 非常感谢
猜你喜欢
  • 1970-01-01
  • 2021-02-18
  • 1970-01-01
  • 2018-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多