wsp-ms-core 1.1.14 → 1.1.15

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.
package/dist/index.cjs CHANGED
@@ -103,9 +103,13 @@ var ValueObject = class {
103
103
 
104
104
  // src/domain/value-objects/DateTime.ts
105
105
  var _DateTime = class _DateTime extends ValueObject {
106
- constructor(value) {
106
+ constructor(value, strictUTC = true) {
107
107
  super(value);
108
- this._dt = import_luxon.DateTime.fromFormat(value, _DateTime.DEFAULT_FORMAT, { zone: "utc" });
108
+ if (strictUTC) {
109
+ this._dt = import_luxon.DateTime.fromFormat(value, _DateTime.DEFAULT_FORMAT, { zone: "utc" });
110
+ } else {
111
+ this._dt = import_luxon.DateTime.fromFormat(value, _DateTime.DEFAULT_FORMAT);
112
+ }
109
113
  }
110
114
  static fromLuxon(dt) {
111
115
  return new _DateTime(_DateTime.toUtcFormat(dt));
@@ -242,6 +246,18 @@ var _DateTime = class _DateTime extends ValueObject {
242
246
  value: this.value
243
247
  };
244
248
  }
249
+ setTimeZone(timeZone, options) {
250
+ let dt;
251
+ if (options) {
252
+ dt = this._dt.setZone(timeZone, options);
253
+ } else {
254
+ dt = this._dt.setZone(timeZone);
255
+ }
256
+ if (!dt.isValid) {
257
+ throw new Error("Invalid date");
258
+ }
259
+ return new _DateTime(dt.toFormat(_DateTime.DEFAULT_FORMAT), false);
260
+ }
245
261
  formatInTimezone(timezone) {
246
262
  const zoned = this._dt.setZone(timezone);
247
263
  if (!zoned.isValid) {