Net DateTime.AddMonths(1) doesn't work the same as Javascript d.setMonth(d.getMonth() + 1)

I have client side date validation that requires one particular Date to be one month from a different date so I use `d.setMonth(d.getMonth() + 1)` and mostly works just fine. For end of month issues as in 1/31/2009, it returns 3/3/2009 and that's great - that's how I'd prefer it handle it. In the code behind, I'm also generating this date but `DateTime.AddMonths(1)` returns 2/28/2009 so that's no good. Is there some way around this?
I can't believe you think 3/3 is exactly one month after 1/31, but whatever!

以上就是Net DateTime.AddMonths(1) doesn't work the same as Javascript d.setMonth(d.getMonth() + 1)的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏