Skip to content

Instantly share code, notes, and snippets.

@mimikun
Created August 23, 2023 11:37
Show Gist options
  • Save mimikun/e3979e2fc487b6d9ac053ad7e3f2a646 to your computer and use it in GitHub Desktop.
Save mimikun/e3979e2fc487b6d9ac053ad7e3f2a646 to your computer and use it in GitHub Desktop.
デイリーノート
// なぜか動かない
<% tp.file.cursor() %>
<%*
// 平日かどうか判別したい
// asyncなんもわからん
async function isWeekDay() {
    let day_of_week = moment(tp.file.title, "YYYY年MM月DD日").weekday(); // 0 or 6
    return day_of_week == 0 ? false
      : day_of_week == 6 ? false
      : true;
}

async function asyncSleep(ms) {
  return new Promise((resolve) => { setTimeout(() => { resolve(); }, ms); });
}

await asyncSleep(50) // waitを入れてみる

if (await isWeekDay()) {
- [ ] 会社でのみ行うタスクA
- [ ] 会社でのみ行うタスクB
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment