質問編集履歴
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="col-12">
|
8
8
|
<label class="col-form-label">登録日: </label>
|
9
9
|
<input class="form-control-input" type="date" v-bind:value="startDate" v-on:blur="onDateChanged(1, $event.target.value)" />
|
10
|
-
<label class="col-form-label"
|
10
|
+
<label class="col-form-label">~</label>
|
11
11
|
<input class="form-control-input" type="date" v-bind:value="endDate" v-on:blur="onDateChanged(2, $event.target.value)" />
|
12
12
|
</div>
|
13
13
|
```
|
5
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
```html
|
7
7
|
<div class="col-12">
|
8
8
|
<label class="col-form-label">登録日: </label>
|
9
|
-
<input class="form-control-input" type="date"
|
9
|
+
<input class="form-control-input" type="date" v-bind:value="startDate" v-on:blur="onDateChanged(1, $event.target.value)" />
|
10
10
|
<label class="col-form-label" for="~">~</label>
|
11
|
-
<input class="form-control-input" type="date" v-bind:value="endDate" v-on:blur="onDateChanged(2, $event.target.value)"
|
11
|
+
<input class="form-control-input" type="date" v-bind:value="endDate" v-on:blur="onDateChanged(2, $event.target.value)" />
|
12
12
|
</div>
|
13
13
|
```
|
14
14
|
|
4
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
-
input type="date"でblurを使ったとき、javascriptで2回目実行以降で日付の差が
|
1
|
+
input type="date"でblurを使ったとき、javascriptで2回目実行以降で日付の差が
|
2
|
+
うまく取得できなくて困っています。
|
3
|
+
vue.js3を使用しています。
|
2
4
|
どなたかご教授お願いします。
|
3
5
|
|
6
|
+
```html
|
7
|
+
<div class="col-12">
|
8
|
+
<label class="col-form-label">登録日: </label>
|
9
|
+
<input class="form-control-input" type="date" style="margin-left: 10px!important;" v-bind:value="startDate" v-on:blur="onDateChanged(1, $event.target.value)" min="1900-01-01" max="3000-12-31" />
|
10
|
+
<label class="col-form-label" for="~">~</label>
|
11
|
+
<input class="form-control-input" type="date" v-bind:value="endDate" v-on:blur="onDateChanged(2, $event.target.value)" min="1900-01-01" max="3000-12-31" />
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
|
4
15
|
```javascript
|
5
16
|
onDateChanged(type, value) {
|
6
17
|
// type:1 はstartDateの時、type:2 はendDateの時
|
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
|
9
9
|
// 実際はblurでこのコードを発生させ、開始日、終了日期間の反転をしないようにしています。
|
10
10
|
// vueでバインドしているのですが、blurの時にthisで取れなかったので$event.target.valueを使用
|
11
|
-
// const startDate = luxon.DateTime.fromISO(value);
|
11
|
+
// const startDate = luxon.DateTime.fromISO(value); // または this.startDate
|
12
|
-
// const endDate = luxon.DateTime.fromISO(this.endDate);
|
12
|
+
// const endDate = luxon.DateTime.fromISO(this.endDate); // または value
|
13
13
|
|
14
14
|
|
15
15
|
let startDate = new Date("2021-06-16");
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
// type:1 はstartDateの時、type:2 はendDateの時
|
7
7
|
// valueは$event.target.valueをとっている
|
8
8
|
|
9
|
-
// 実際
|
9
|
+
// 実際はblurでこのコードを発生させ、開始日、終了日期間の反転をしないようにしています。
|
10
10
|
// vueでバインドしているのですが、blurの時にthisで取れなかったので$event.target.valueを使用
|
11
11
|
// const startDate = luxon.DateTime.fromISO(value);
|
12
12
|
// const endDate = luxon.DateTime.fromISO(this.endDate);
|
1
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
input type="date"でblurを使ったとき、javascriptで2回目実行以降で日付の差がうまく取得できない
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
input type="date"でblurを使ったとき、javascriptで2回目実行以降で日付の差がうまく取得できなくて困っています。
|
2
2
|
どなたかご教授お願いします。
|
3
3
|
|
4
4
|
```javascript
|