LoginSignup
1
1

More than 5 years have passed since last update.

Sugar.jsで翌日のDateオブジェクトを産む

Posted at

できなかった(そらそうよ)

// 今日は11/24だよ。
var today = new Sugar.Date();
var tomorrow = today.addDays(1);

console.log(today.format("{M}/{d}")); // 11/25
console.log(tommorow.format("{M}/{d}")); // 11/25

※おっさんは何故かDateオブジェクトをオブジェクトじゃないと脳が誤解してる。

できた(そらそうよ)

// 今日は11/24だよ。
var today = new Sugar.Date();
var tomorrow = today.clone().addDays(1);

console.log(today.format("{M}/{d}")); // 11/24
console.log(tommorow.format("{M}/{d}")); // 11/25
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1