Skip to content

Instantly share code, notes, and snippets.

@keidarcy
Last active June 16, 2020 07:43
Show Gist options
  • Save keidarcy/0e69062c9c81a2fd36a3f74fc530ca3d to your computer and use it in GitHub Desktop.
Save keidarcy/0e69062c9c81a2fd36a3f74fc530ca3d to your computer and use it in GitHub Desktop.
My Japon dev memo
// 4月から計算一年内のもの
<!-- ・現在の日付が4月以降だったら
→4月から現在の日付カウントする
・現在の日付が3月以前だったら
→去年の4月から現在の日付までカウントする -->
private function isAnnual($date)
{
$orderTime = $date->format('Y-m-d');
if (date('m') >= 4) {
if (strtotime(date('Y').'-04-01') < strtotime($orderTime)
&& (strtotime((date('Y') + 1).'-04-01')) > strtotime($orderTime)
) {
return true;
} else {
return false;
}
} else {
if (strtotime(date('Y').'-04-01') > strtotime($orderTime)
&& (strtotime((date('Y') - 1).'-04-01')) < strtotime($orderTime)) {
return true;
} else {
return false;
}
}
}

カタカナ

\u30a0-\u30ff

ひらがな

\u3040-\u309f

々, 〆(記号)

\u3005-\u3006

CJK統合漢字

\u30e0-\u9fcf

「々」って記号

value.match(/^[\u30a0-\u30ff\u3040-\u309f\u3005-\u3006\u30e0-\u9fcf]+$/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment