You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HTML5 supports datepicker for "datetime-local" (without timezone) but not "datetime" which uses timezone.
If you use the below custom editor, it will let you edit it with the HTML5 datetime-local datepicker,
but still get JSON with (default)) timezone.
// Custom editorJSONEditor.defaults.editors.dateTime=JSONEditor.defaults.editors.string.extend({getValue: function(){functiongetTimeZone(){varoffset=newDate().getTimezoneOffset(),o=Math.abs(offset);return(offset<0 ? "+" : "-")+("00"+Math.floor(o/60)).slice(-2)+":"+("00"+(o%60)).slice(-2);}returnthis.value+getTimeZone();},setValue: function(val){// strip timeZonevarstripedDateTime=val.substring(0,val.lastIndexOf("+"));if(this.value!==stripedDateTime){this.value=stripedDateTime;this.input.value=this.value;this.refreshPreview();this.onChange();}},build: function(){this.schema.format="datetime-local";this._super();}});// Instruct the json-editor to use the custom datetime-editor.JSONEditor.defaults.resolvers.unshift(function(schema){if(schema.type==="string"&&schema.format==="datetime"){return"dateTime";}});
The text was updated successfully, but these errors were encountered:
Hi,
HTML5 supports datepicker for "datetime-local" (without timezone) but not "datetime" which uses timezone.
If you use the below custom editor, it will let you edit it with the HTML5 datetime-local datepicker,
but still get JSON with (default)) timezone.
The text was updated successfully, but these errors were encountered: