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.
1 parent 238639f commit 5623b73Copy full SHA for 5623b73
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