@formio/js 5.1.0-dev.6080.9f2079e → 5.1.0-dev.6082.51d4e33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { Formio } from '../Formio';
2
2
  import InputWidget from './InputWidget';
3
- import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, } from '../utils/utils';
3
+ import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, hasEncodedTimezone, } from '../utils/utils';
4
4
  import moment from 'moment';
5
5
  import _ from 'lodash';
6
6
  const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
@@ -278,6 +278,11 @@ export default class CalendarWidget extends InputWidget {
278
278
  value = value ? formatDate(this.timezonesUrl, value, convertFormatToMoment(this.settings.format), this.timezone, convertFormatToMoment(this.valueMomentFormat)) : value;
279
279
  return super.setValue(value);
280
280
  }
281
+ // If the component is a textfield that does not have timezone information included in the string value then skip
282
+ // the timezone offset
283
+ if (this.component.type === 'textfield' && !hasEncodedTimezone(value)) {
284
+ this.settings.skipOffset = true;
285
+ }
281
286
  const zonesLoading = this.loadZones();
282
287
  if (value) {
283
288
  if (!saveAsText && this.settings.readOnly && !zonesLoading) {
@@ -443,7 +448,7 @@ export default class CalendarWidget extends InputWidget {
443
448
  return (date, format) => {
444
449
  // Only format this if this is the altFormat and the form is readOnly.
445
450
  if (this.settings.readOnly && (format === this.settings.altFormat)) {
446
- if (!this.settings.enableTime || this.loadZones()) {
451
+ if (!this.settings.enableTime || this.loadZones() || this.settings.skipOffset) {
447
452
  return Flatpickr.formatDate(date, format);
448
453
  }
449
454
  const currentValue = new Date(this.getValue());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6080.9f2079e",
3
+ "version": "5.1.0-dev.6082.51d4e33",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {