wsp-ms-core 1.1.18 → 1.1.19

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
@@ -265,15 +265,25 @@ var _DateTime = class _DateTime extends ValueObject {
265
265
  }
266
266
  return zoned.toFormat(_DateTime.DEFAULT_FORMAT);
267
267
  }
268
- static create(input) {
269
- if (input === void 0) {
268
+ static create(input, format = _DateTime.FORMAT) {
269
+ if (input === void 0 || input === null) {
270
270
  return new _DateTime(_DateTime.toUtcFormat(import_luxon.DateTime.now()));
271
271
  }
272
+ if (input instanceof import_luxon.DateTime) {
273
+ return new _DateTime(_DateTime.toUtcFormat(input));
274
+ }
275
+ if (input instanceof Date) {
276
+ return new _DateTime(_DateTime.toUtcFormat(import_luxon.DateTime.fromJSDate(input, { zone: "utc" })));
277
+ }
272
278
  if (typeof input === "number") {
273
279
  return new _DateTime(
274
280
  _DateTime.toUtcFormat(import_luxon.DateTime.fromMillis(input, { zone: "utc" }))
275
281
  );
276
282
  }
283
+ const fromDefault = import_luxon.DateTime.fromFormat(input, _DateTime.DEFAULT_FORMAT, { zone: "utc" });
284
+ if (fromDefault.isValid) {
285
+ return new _DateTime(input);
286
+ }
277
287
  const iso = import_luxon.DateTime.fromISO(input, { zone: "utc" });
278
288
  if (iso.isValid) {
279
289
  return new _DateTime(_DateTime.toUtcFormat(iso));