質問編集履歴
3
Lhankor_Mhy様の回答をもとにテスト
title
CHANGED
File without changes
|
body
CHANGED
@@ -103,4 +103,31 @@
|
|
103
103
|
土曜日は14:00までは当日の日付、14:00~17:00までは翌日の日付、それ以降は月曜日の日付
|
104
104
|
日曜日は休日
|
105
105
|
|
106
|
-
にしたいです。
|
106
|
+
にしたいです。
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
追記
|
112
|
+
|
113
|
+
テストのため、火曜日を休みと想定して下記のように記述しましたが
|
114
|
+
現在時刻で10/13水になってしまう。
|
115
|
+
|
116
|
+
```
|
117
|
+
function isHoliday(year,month,date,nday){
|
118
|
+
nofw=Math.floor((date-1)/7)+1;
|
119
|
+
shunbun=Math.floor(20.8431+0.242194*(year-1980)-Math.floor((year-1980)/4));
|
120
|
+
syubun=Math.floor(23.2488+0.242194*(year-1980)-Math.floor((year-1980)/4));
|
121
|
+
if(month==1 && date==1){return 1;} //元旦
|
122
|
+
if(month==1 && date==2){return 1;} //元旦
|
123
|
+
if(month==1 && date==3){return 1;} //元旦
|
124
|
+
if(myHours < 17){
|
125
|
+
if (nday == 2) { return 1; } // 日曜
|
126
|
+
}
|
127
|
+
|
128
|
+
if (nday == 2) { return 1; } // 日曜
|
129
|
+
|
130
|
+
return 0;
|
131
|
+
|
132
|
+
}
|
133
|
+
```
|
2
質問のまとめを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -94,4 +94,13 @@
|
|
94
94
|
なのですが、ndayの値に6や0が入ってきて
|
95
95
|
正確に求められませんでした。
|
96
96
|
|
97
|
-
どのようにすれば解決できるでしょうか?
|
97
|
+
どのようにすれば解決できるでしょうか?
|
98
|
+
|
99
|
+
|
100
|
+
質問をまとめると
|
101
|
+
|
102
|
+
月~金は14:00までは当日の日付、それ以降は翌日の日付
|
103
|
+
土曜日は14:00までは当日の日付、14:00~17:00までは翌日の日付、それ以降は月曜日の日付
|
104
|
+
日曜日は休日
|
105
|
+
|
106
|
+
にしたいです。
|
1
日曜日休日判定の追加と試したことの説明追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
shunbun = Math.floor(20.8431+0.242194*(year-1980)-Math.floor((year-1980)/4));
|
18
18
|
syubun = Math.floor(23.2488+0.242194*(year-1980)-Math.floor((year-1980)/4));
|
19
19
|
if (month == 1 && date == 1) { return 1; } // 元旦
|
20
|
-
|
20
|
+
if (nday == 0) { return 2; } // 日曜
|
21
21
|
|
22
22
|
return 0;
|
23
23
|
}
|
@@ -84,6 +84,7 @@
|
|
84
84
|
土曜日17:00までは日曜日出荷もしたいと考えてます。
|
85
85
|
|
86
86
|
考えたのが
|
87
|
+
function isHolidayに下記を追記
|
87
88
|
```
|
88
89
|
if(myHours >= 17){
|
89
90
|
if (nday == 0) { return 1; } // 日曜
|