We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 238639f + 5623b73 commit 2f9c6e4Copy full SHA for 2f9c6e4
src/date.js
@@ -69,8 +69,11 @@ function formatDate(value) {
69
: value;
70
}
71
72
+// The datetime-local input uses YYYY-MM-DDThh:mm like ISO 8601, but in local
73
+// time rather than UTC, so we apply the offset before calling toISOString.
74
+// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
75
function formatDatetime(value) {
76
return (value = coerce(value))
- ? value.toISOString().slice(0, 16)
77
+ ? (new Date(+value - value.getTimezoneOffset() * 1000 * 60)).toISOString().slice(0, 16)
78
79
0 commit comments