acsi-core 1.2.16 → 1.2.18

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.
@@ -3500,25 +3500,43 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3500
3500
  }, rest));
3501
3501
  };
3502
3502
 
3503
+ var isDateOnlyFormat = function isDateOnlyFormat(fmt) {
3504
+ return !/[Hhms]/.test(fmt);
3505
+ };
3506
+ var parseOffsetToMinutes = function parseOffsetToMinutes(cleanOffset) {
3507
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3508
+ return parseInt(cleanOffset, 10) * 60;
3509
+ }
3510
+ return moment().utcOffset(cleanOffset).utcOffset();
3511
+ };
3503
3512
  var utcToLocalTime = (function (time, FORMAT) {
3504
3513
  if (time === DATE_MIN_VALUE || time == null) return "";
3505
3514
  var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3515
+ var fmt = FORMAT || "yyyy-MM-DD";
3506
3516
  try {
3507
3517
  if (!timezone) {
3508
- return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3518
+ if (isDateOnlyFormat(fmt)) {
3519
+ var localOffset = moment().utcOffset();
3520
+ if (localOffset <= 0) return moment.utc(time).format(fmt);
3521
+ }
3522
+ return moment.utc(time).local().format(fmt);
3509
3523
  }
3510
3524
  var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3511
3525
  if (isOffset) {
3512
3526
  var cleanOffset = timezone.replace(/UTC|GMT/gi, "").trim();
3513
- var offsetMinutes;
3514
- if (/^[+-]?\d+$/.test(cleanOffset)) {
3515
- offsetMinutes = parseInt(cleanOffset, 10) * 60;
3516
- } else {
3517
- offsetMinutes = cleanOffset;
3527
+ var offsetMinutes = parseOffsetToMinutes(cleanOffset);
3528
+ if (isDateOnlyFormat(fmt) && offsetMinutes <= 0) {
3529
+ return moment.utc(time).format(fmt);
3530
+ }
3531
+ return moment.utc(time).utcOffset(offsetMinutes).format(fmt);
3532
+ }
3533
+ if (isDateOnlyFormat(fmt)) {
3534
+ var tzOffset = moment.utc(time).tz(timezone).utcOffset();
3535
+ if (tzOffset <= 0) {
3536
+ return moment.utc(time).format(fmt);
3518
3537
  }
3519
- return moment.utc(time).utcOffset(offsetMinutes).format(FORMAT || "yyyy-MM-DD");
3520
3538
  }
3521
- return moment.utc(time).tz(timezone).format(FORMAT || "yyyy-MM-DD");
3539
+ return moment.utc(time).tz(timezone).format(fmt);
3522
3540
  } catch (_unused) {
3523
3541
  return "";
3524
3542
  }