@h3ravel/support 0.16.1 → 0.17.0-alpha.1

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
@@ -1,68 +1,11 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (all, symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
- key = keys[i];
25
- if (!__hasOwnProp.call(to, key) && key !== except) {
26
- __defProp(to, key, {
27
- get: ((k) => from[k]).bind(null, key),
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- });
30
- }
31
- }
32
- }
33
- return to;
34
- };
35
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
36
- value: mod,
37
- enumerable: true
38
- }) : target, mod));
39
-
40
- //#endregion
41
- const require_RuntimeException = require('./RuntimeException-CmsL83ow.cjs');
1
+ const require_Time = require('./Time-H1gLMvCJ.cjs');
2
+ const require_RuntimeException = require('./RuntimeException-BlF2onMq.cjs');
42
3
  let __h3ravel_collect_js = require("@h3ravel/collect.js");
43
4
  let crypto$1 = require("crypto");
44
5
  let process = require("process");
45
- process = __toESM(process);
6
+ process = require_Time.__toESM(process);
46
7
  let util = require("util");
47
- util = __toESM(util);
48
- let dayjs = require("dayjs");
49
- dayjs = __toESM(dayjs);
50
- let dayjs_plugin_advancedFormat_js = require("dayjs/plugin/advancedFormat.js");
51
- dayjs_plugin_advancedFormat_js = __toESM(dayjs_plugin_advancedFormat_js);
52
- let dayjs_plugin_customParseFormat_js = require("dayjs/plugin/customParseFormat.js");
53
- dayjs_plugin_customParseFormat_js = __toESM(dayjs_plugin_customParseFormat_js);
54
- let dayjs_plugin_dayOfYear_js = require("dayjs/plugin/dayOfYear.js");
55
- dayjs_plugin_dayOfYear_js = __toESM(dayjs_plugin_dayOfYear_js);
56
- let dayjs_plugin_isBetween_js = require("dayjs/plugin/isBetween.js");
57
- dayjs_plugin_isBetween_js = __toESM(dayjs_plugin_isBetween_js);
58
- let dayjs_plugin_isLeapYear_js = require("dayjs/plugin/isLeapYear.js");
59
- dayjs_plugin_isLeapYear_js = __toESM(dayjs_plugin_isLeapYear_js);
60
- let dayjs_plugin_relativeTime_js = require("dayjs/plugin/relativeTime.js");
61
- dayjs_plugin_relativeTime_js = __toESM(dayjs_plugin_relativeTime_js);
62
- let dayjs_plugin_timezone_js = require("dayjs/plugin/timezone.js");
63
- dayjs_plugin_timezone_js = __toESM(dayjs_plugin_timezone_js);
64
- let dayjs_plugin_utc_js = require("dayjs/plugin/utc.js");
65
- dayjs_plugin_utc_js = __toESM(dayjs_plugin_utc_js);
8
+ util = require_Time.__toESM(util);
66
9
  let node_net = require("node:net");
67
10
  let __h3ravel_shared = require("@h3ravel/shared");
68
11
  let node_fs_promises = require("node:fs/promises");
@@ -110,7 +53,7 @@ var InvalidArgumentException = class extends Error {
110
53
 
111
54
  //#endregion
112
55
  //#region src/Helpers/Crypto.ts
113
- var Crypto_exports = /* @__PURE__ */ __export({
56
+ var Crypto_exports = /* @__PURE__ */ require_Time.__export({
114
57
  base64Decode: () => base64Decode,
115
58
  base64Encode: () => base64Encode,
116
59
  caesarCipher: () => caesarCipher,
@@ -283,7 +226,7 @@ const caesarCipher = (text, shift = 13) => {
283
226
 
284
227
  //#endregion
285
228
  //#region src/Helpers/DumpDie.ts
286
- var DumpDie_exports = /* @__PURE__ */ __export({
229
+ var DumpDie_exports = /* @__PURE__ */ require_Time.__export({
287
230
  dd: () => dd,
288
231
  dump: () => dump
289
232
  });
@@ -318,7 +261,7 @@ const dump = (...args) => {
318
261
 
319
262
  //#endregion
320
263
  //#region src/Helpers/Number.ts
321
- var Number_exports = /* @__PURE__ */ __export({
264
+ var Number_exports = /* @__PURE__ */ require_Time.__export({
322
265
  abbreviate: () => abbreviate,
323
266
  humanize: () => humanize,
324
267
  toBytes: () => toBytes,
@@ -918,6 +861,24 @@ var Obj = class Obj {
918
861
  });
919
862
  }
920
863
  /**
864
+ * Checks if an object is not empty
865
+ *
866
+ * @param obj
867
+ * @returns
868
+ */
869
+ static isNotEmpty(obj) {
870
+ return Object.keys(obj).length >= 1;
871
+ }
872
+ /**
873
+ * Checks if an object is empty
874
+ *
875
+ * @param obj
876
+ * @returns
877
+ */
878
+ static isEmpty(obj) {
879
+ return !this.isNotEmpty(obj);
880
+ }
881
+ /**
921
882
  * Check if an object is associative (has at least one non-numeric key).
922
883
  *
923
884
  * @param obj
@@ -938,6 +899,36 @@ var Obj = class Obj {
938
899
  return isPlainObject(value, allowArray);
939
900
  }
940
901
  /**
902
+ * Removes the last element from an object and returns it.
903
+ * If the object is empty, undefined is returned and the object is not modified.
904
+ *
905
+ * @param obj
906
+ * @returns
907
+ */
908
+ static pop(obj) {
909
+ const keys = Object.keys(obj);
910
+ if (!keys.length) return void 0;
911
+ const lastKey = keys[keys.length - 1];
912
+ const value = obj[lastKey];
913
+ delete obj[lastKey];
914
+ return value;
915
+ }
916
+ /**
917
+ * Removes the first element from an array and returns it.
918
+ * If the array is empty, undefined is returned and the array is not modified.
919
+ *
920
+ * @param obj
921
+ * @returns
922
+ */
923
+ static shift(obj) {
924
+ const keys = Object.keys(obj);
925
+ if (!keys.length) return void 0;
926
+ const firstKey = keys[0];
927
+ const value = obj[firstKey];
928
+ delete obj[firstKey];
929
+ return value;
930
+ }
931
+ /**
941
932
  * Add a prefix to all keys of the object.
942
933
  *
943
934
  * @param obj
@@ -970,6 +961,16 @@ var Obj = class Obj {
970
961
  return parts.join("&");
971
962
  }
972
963
  /**
964
+ * If the given value is not an associative object, wrap it in one.
965
+ *
966
+ * @param value
967
+ */
968
+ static wrap(value) {
969
+ value = typeof value === "string" || typeof value === "number" ? this.arrayWrap(value) : value;
970
+ if (Array.isArray(value)) value = Object.fromEntries(value.map((e, i) => [i, e]));
971
+ return value;
972
+ }
973
+ /**
973
974
  * undot
974
975
  *
975
976
  * Convert a dot-notated object back into nested structure.
@@ -980,9 +981,21 @@ var Obj = class Obj {
980
981
  * @param obj
981
982
  * @returns
982
983
  */
983
- undot(obj) {
984
+ static undot(obj) {
984
985
  return undot(obj);
985
986
  }
987
+ /**
988
+ * If the given value is not an array and not null, wrap it in one.
989
+ *
990
+ * Non-array values become [value]; null/undefined becomes [].
991
+ *
992
+ * @param value
993
+ * @returns
994
+ */
995
+ static arrayWrap(value) {
996
+ if (value === null || value === void 0) return [];
997
+ return Array.isArray(value) ? value : [value];
998
+ }
986
999
  };
987
1000
 
988
1001
  //#endregion
@@ -1669,173 +1682,6 @@ var Arr = class Arr {
1669
1682
  }
1670
1683
  };
1671
1684
 
1672
- //#endregion
1673
- //#region src/Helpers/Time.ts
1674
- dayjs.default.extend(dayjs_plugin_utc_js.default);
1675
- dayjs.default.extend(dayjs_plugin_timezone_js.default);
1676
- dayjs.default.extend(dayjs_plugin_dayOfYear_js.default);
1677
- dayjs.default.extend(dayjs_plugin_isBetween_js.default);
1678
- dayjs.default.extend(dayjs_plugin_isLeapYear_js.default);
1679
- dayjs.default.extend(dayjs_plugin_relativeTime_js.default);
1680
- dayjs.default.extend(dayjs_plugin_advancedFormat_js.default);
1681
- dayjs.default.extend(dayjs_plugin_customParseFormat_js.default);
1682
- const phpToDayjsTokens = (format$1) => format$1.replace(/Y/g, "YYYY").replace(/m/g, "MM").replace(/d/g, "DD").replace(/H/g, "HH").replace(/i/g, "mm").replace(/s/g, "ss");
1683
- function format(date, fmt) {
1684
- return (0, dayjs.default)(date).format(phpToDayjsTokens(fmt));
1685
- }
1686
- const TimeClass = class {};
1687
- var DateTime = class DateTime extends TimeClass {
1688
- instance;
1689
- constructor(config, format$1, locale, strict) {
1690
- super(config);
1691
- this.instance = (0, dayjs.default)(config, format$1, locale, strict);
1692
- return new Proxy(this, { get: (target, prop, receiver) => {
1693
- if (prop in target) return Reflect.get(target, prop, receiver);
1694
- const value = Reflect.get(this.instance, prop, receiver);
1695
- if (typeof value === "function") return (...args) => {
1696
- const result = value.apply(this.instance, args);
1697
- return dayjs.default.isDayjs(result) ? new DateTime(result) : result;
1698
- };
1699
- return value;
1700
- } });
1701
- }
1702
- /**
1703
- * Start time of a specific unit.
1704
- *
1705
- * @returns
1706
- */
1707
- start(unit = "days") {
1708
- return this.startOf(unit);
1709
- }
1710
- /**
1711
- * Set the timezone for the instance
1712
- *
1713
- * @param timezone
1714
- * @returns
1715
- */
1716
- setTimezone(timezone$1, keepLocalTime) {
1717
- return new DateTime(this.tz(timezone$1, keepLocalTime));
1718
- }
1719
- /**
1720
- * End time of a specific unit.
1721
- *
1722
- * @returns
1723
- */
1724
- end(unit = "days") {
1725
- return this.endOf(unit);
1726
- }
1727
- /**
1728
- * Get the first day of the month of the given date
1729
- *
1730
- * @returns
1731
- */
1732
- firstDayOfMonth() {
1733
- return new DateTime(new Date(Date.UTC(this.year(), this.month(), 1)));
1734
- }
1735
- carbonFormat(template) {
1736
- return template ? this.format(phpToDayjsTokens(template)) : this.format();
1737
- }
1738
- /**
1739
- * Get the last day of the month of the given date
1740
- *
1741
- * @returns
1742
- */
1743
- lastDayOfMonth() {
1744
- return new DateTime(new Date(Date.UTC(this.year(), this.month() + 1, 0)));
1745
- }
1746
- /**
1747
- * Get a random time between the specified hour and minute.
1748
- *
1749
- * @param startHour
1750
- * @param startMinute
1751
- * @param endHour
1752
- * @param endMinute
1753
- * @returns
1754
- */
1755
- randomTime(startHour = 9, startMinute = 0, endHour = 17, endMinute = 0) {
1756
- const today = /* @__PURE__ */ new Date();
1757
- const startMinutes = startHour * 60 + startMinute;
1758
- const endMinutes = endHour * 60 + endMinute;
1759
- const randomMinutes = Math.floor(Math.random() * (endMinutes - startMinutes)) + startMinutes;
1760
- const hour = Math.floor(randomMinutes / 60);
1761
- const minute = randomMinutes % 60;
1762
- const date = new Date(today);
1763
- date.setHours(hour, minute, 0, 0);
1764
- return new DateTime(date);
1765
- }
1766
- /**
1767
- * Create a date for a given timestamp.
1768
- *
1769
- * @param timestamp - Unix timestamp
1770
- *
1771
- * @return {Date} object
1772
- */
1773
- static fromTimestamp(timestamp) {
1774
- return new DateTime(timestamp * 1e3);
1775
- }
1776
- /**
1777
- * Get current time instance.
1778
- *
1779
- * @returns Current time
1780
- */
1781
- static now() {
1782
- return new DateTime();
1783
- }
1784
- /**
1785
- * Parse the time
1786
- *
1787
- * @param date
1788
- * @returns
1789
- */
1790
- static parse(date) {
1791
- return new DateTime(date);
1792
- }
1793
- /**
1794
- * Get the formatted date according to the string of tokens passed in.
1795
- *
1796
- * To escape characters, wrap them in square brackets (e.g. [MM]).
1797
- *
1798
- * @param time - current time
1799
- * @param template - time format
1800
- */
1801
- static format(time, template) {
1802
- return new DateTime(time).format(template);
1803
- }
1804
- /**
1805
- * Get the difference in days from today.
1806
- *
1807
- * @param time
1808
- * @param startHour
1809
- * @param startMinute
1810
- * @param endHour
1811
- * @param endMinute
1812
- * @returns
1813
- */
1814
- static randomTime(time, startHour, startMinute, endHour, endMinute) {
1815
- return new DateTime(time).randomTime(startHour, startMinute, endHour, endMinute);
1816
- }
1817
- /**
1818
- * Get the first day of the month of the given date
1819
- *
1820
- * @param time
1821
- *
1822
- * @returns
1823
- */
1824
- static firstDayOfMonth(time) {
1825
- return new DateTime(time).firstDayOfMonth();
1826
- }
1827
- /**
1828
- * Get the last day of the month of the given date
1829
- *
1830
- * @param time
1831
- *
1832
- * @returns
1833
- */
1834
- static lastDayOfMonth(time) {
1835
- return new DateTime(time).lastDayOfMonth();
1836
- }
1837
- };
1838
-
1839
1685
  //#endregion
1840
1686
  //#region src/Helpers/Str.ts
1841
1687
  let Mode = /* @__PURE__ */ function(Mode$1) {
@@ -6071,12 +5917,12 @@ var Stringable = class Stringable {
6071
5917
  break;
6072
5918
  }
6073
5919
  case "Z": {
6074
- const timezone$1 = now.toLocaleDateString("en-us", {
5920
+ const timezone = now.toLocaleDateString("en-us", {
6075
5921
  timeZoneName: "longOffset",
6076
5922
  timeZone: tz ?? void 0
6077
5923
  });
6078
- const symbol = timezone$1.match(/[+-]/);
6079
- const data = timezone$1.split(/[+-]/);
5924
+ const symbol = timezone.match(/[+-]/);
5925
+ const data = timezone.split(/[+-]/);
6080
5926
  const sign = symbol ? symbol.pop() : "+";
6081
5927
  const offset = data.length === 2 ? data[1] : "0:00";
6082
5928
  const hours$1 = parseInt(offset.split(":")[0]);
@@ -6280,7 +6126,7 @@ function loadHelpers(target = globalThis) {
6280
6126
  Number: Number_exports,
6281
6127
  Obj,
6282
6128
  Str,
6283
- DateTime,
6129
+ DateTime: require_Time.DateTime,
6284
6130
  DumpDie: DumpDie_exports,
6285
6131
  apa: Str.apa,
6286
6132
  title: Str.title,
@@ -6330,13 +6176,13 @@ function loadHelpers(target = globalThis) {
6330
6176
  checksum,
6331
6177
  verifyChecksum,
6332
6178
  caesarCipher,
6333
- now: DateTime.now,
6334
- format: DateTime.format,
6335
- fromTimestamp: DateTime.fromTimestamp,
6336
- parse: DateTime.parse,
6337
- randomTime: DateTime.randomTime,
6338
- firstDayOfMonth: DateTime.firstDayOfMonth,
6339
- lastDayOfMonth: DateTime.lastDayOfMonth,
6179
+ now: require_Time.DateTime.now,
6180
+ format: require_Time.DateTime.format,
6181
+ fromTimestamp: require_Time.DateTime.fromTimestamp,
6182
+ parse: require_Time.DateTime.parse,
6183
+ randomTime: require_Time.DateTime.randomTime,
6184
+ firstDayOfMonth: require_Time.DateTime.firstDayOfMonth,
6185
+ lastDayOfMonth: require_Time.DateTime.lastDayOfMonth,
6340
6186
  abbreviate,
6341
6187
  humanize,
6342
6188
  toBytes,
@@ -7045,7 +6891,7 @@ Object.defineProperty(exports, 'Crypto', {
7045
6891
  return Crypto_exports;
7046
6892
  }
7047
6893
  });
7048
- exports.DateTime = DateTime;
6894
+ exports.DateTime = require_Time.DateTime;
7049
6895
  exports.HigherOrderTapProxy = HigherOrderTapProxy;
7050
6896
  exports.HtmlString = HtmlString;
7051
6897
  exports.InvalidArgumentException = InvalidArgumentException;
@@ -7065,7 +6911,6 @@ exports.ServiceProvider = ServiceProvider;
7065
6911
  exports.Str = Str;
7066
6912
  exports.Stringable = Stringable;
7067
6913
  exports.Tappable = Tappable;
7068
- exports.__toESM = __toESM;
7069
6914
  exports.abbreviate = abbreviate;
7070
6915
  exports.base64Decode = base64Decode;
7071
6916
  exports.base64Encode = base64Encode;
@@ -7082,7 +6927,7 @@ exports.dd = dd;
7082
6927
  exports.dot = dot;
7083
6928
  exports.dump = dump;
7084
6929
  exports.extractProperties = extractProperties;
7085
- exports.format = format;
6930
+ exports.format = require_Time.format;
7086
6931
  exports.getValue = getValue;
7087
6932
  exports.hash = hash;
7088
6933
  exports.hmac = hmac;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
+ import { n as format, t as DateTime } from "./Time-DY_lqAIR.js";
2
3
  import "node:module";
3
4
  import { CallableConstructor, ClassConstructor, ConcreteConstructor, IApplication, IServiceProvider } from "@h3ravel/contracts";
4
- import { Collection as Collection$1 } from "@h3ravel/collect.js";
5
5
  import * as _h3ravel_shared0 from "@h3ravel/shared";
6
6
  import { DotFlatten, DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
7
- import dayjs, { ConfigType, Dayjs, OpUnitType, OptionType } from "dayjs";
7
+ import { Collection as Collection$1 } from "@h3ravel/collect.js";
8
8
 
9
9
  //#region rolldown:runtime
10
10
  //#endregion
@@ -466,7 +466,7 @@ declare function data_forget(obj: Record<string, any>, path: string | string[]):
466
466
  * @param allowArray
467
467
  * @returns
468
468
  */
469
- declare function isPlainObject<P = any>(value: P, allowArray?: boolean): value is P;
469
+ declare function isPlainObject<P extends Record<string, unknown>>(value: unknown, allowArray?: boolean): value is P;
470
470
  declare class Obj {
471
471
  /**
472
472
  * Check if the value is a non-null object (associative/accessible).
@@ -553,13 +553,27 @@ declare class Obj {
553
553
  * @returns
554
554
  */
555
555
  static has<T$1 extends object, P extends DotPath<T$1>>(obj: T$1, keys: P | P[]): boolean;
556
+ /**
557
+ * Checks if an object is not empty
558
+ *
559
+ * @param obj
560
+ * @returns
561
+ */
562
+ static isNotEmpty<T$1 extends Record<string, unknown>>(obj: T$1): obj is T$1;
563
+ /**
564
+ * Checks if an object is empty
565
+ *
566
+ * @param obj
567
+ * @returns
568
+ */
569
+ static isEmpty<T$1 extends Record<string, unknown>>(obj: T$1): obj is never;
556
570
  /**
557
571
  * Check if an object is associative (has at least one non-numeric key).
558
572
  *
559
573
  * @param obj
560
574
  * @returns
561
575
  */
562
- static isAssoc(obj: unknown): obj is Record<string, any>;
576
+ static isAssoc<T$1 extends Record<string, unknown>>(obj: unknown): obj is T$1;
563
577
  /**
564
578
  * Checks if a value is a plain object (not array, function, etc.)
565
579
  *
@@ -567,7 +581,23 @@ declare class Obj {
567
581
  * @param allowArray
568
582
  * @returns
569
583
  */
570
- static isPlainObject<P = any>(value: P, allowArray?: boolean): value is P;
584
+ static isPlainObject<T$1 extends Record<string, unknown>>(value: unknown, allowArray?: boolean): value is T$1;
585
+ /**
586
+ * Removes the last element from an object and returns it.
587
+ * If the object is empty, undefined is returned and the object is not modified.
588
+ *
589
+ * @param obj
590
+ * @returns
591
+ */
592
+ static pop<T$1 extends Record<string, any>>(obj: T$1): T$1[keyof T$1] | undefined;
593
+ /**
594
+ * Removes the first element from an array and returns it.
595
+ * If the array is empty, undefined is returned and the array is not modified.
596
+ *
597
+ * @param obj
598
+ * @returns
599
+ */
600
+ static shift<T$1 extends Record<string, any>>(obj: T$1): T$1[keyof T$1] | undefined;
571
601
  /**
572
602
  * Add a prefix to all keys of the object.
573
603
  *
@@ -585,6 +615,12 @@ declare class Obj {
585
615
  * @returns
586
616
  */
587
617
  static query(obj: Record<string, any>): string;
618
+ /**
619
+ * If the given value is not an associative object, wrap it in one.
620
+ *
621
+ * @param value
622
+ */
623
+ static wrap<N = any>(value: N | Record<string, N> | N[]): Record<string, N>;
588
624
  /**
589
625
  * undot
590
626
  *
@@ -596,7 +632,16 @@ declare class Obj {
596
632
  * @param obj
597
633
  * @returns
598
634
  */
599
- undot(obj: Record<string, any>): Record<string, any>;
635
+ static undot(obj: Record<string, any>): Record<string, any>;
636
+ /**
637
+ * If the given value is not an array and not null, wrap it in one.
638
+ *
639
+ * Non-array values become [value]; null/undefined becomes [].
640
+ *
641
+ * @param value
642
+ * @returns
643
+ */
644
+ private static arrayWrap;
600
645
  }
601
646
  //#endregion
602
647
  //#region src/Helpers/Arr.d.ts
@@ -651,7 +696,7 @@ declare class Arr {
651
696
  * Arr.divide(['a','b']) -> [[0,1], ['a','b']]
652
697
  * Arr.divide({x:1,y:2}) -> [['x','y'], [1,2]]
653
698
  */
654
- static divide<A$1>(input: A$1[] | Record<string, A$1>): (number[] | A$1[])[] | (string[] | A$1[])[];
699
+ static divide<A$1>(input: A$1[] | Record<string, A$1>): (number[] | A$1[])[] | (A$1[] | string[])[];
655
700
  /**
656
701
  * Flatten a nested array/object structure into a single-level object
657
702
  * with dot-notated keys.
@@ -995,116 +1040,6 @@ declare class Arr {
995
1040
  static unique<T$1 = any>(items: T$1[]): T$1[];
996
1041
  }
997
1042
  //#endregion
998
- //#region src/Helpers/Time.d.ts
999
- declare function format(date: ConfigType, fmt: string): string;
1000
- declare const TimeClass: {
1001
- new (date?: dayjs.ConfigType): Dayjs;
1002
- } & typeof Dayjs;
1003
- declare class DateTime extends TimeClass {
1004
- private instance;
1005
- constructor(config?: ConfigType);
1006
- constructor(config?: ConfigType, format?: OptionType, locale?: boolean);
1007
- /**
1008
- * Start time of a specific unit.
1009
- *
1010
- * @returns
1011
- */
1012
- start(unit?: OpUnitType): dayjs.Dayjs;
1013
- /**
1014
- * Set the timezone for the instance
1015
- *
1016
- * @param timezone
1017
- * @returns
1018
- */
1019
- setTimezone(timezone?: string | undefined, keepLocalTime?: boolean | undefined): DateTime;
1020
- /**
1021
- * End time of a specific unit.
1022
- *
1023
- * @returns
1024
- */
1025
- end(unit?: OpUnitType): dayjs.Dayjs;
1026
- /**
1027
- * Get the first day of the month of the given date
1028
- *
1029
- * @returns
1030
- */
1031
- firstDayOfMonth(): DateTime;
1032
- carbonFormat(template?: string | undefined): string;
1033
- /**
1034
- * Get the last day of the month of the given date
1035
- *
1036
- * @returns
1037
- */
1038
- lastDayOfMonth(): DateTime;
1039
- /**
1040
- * Get a random time between the specified hour and minute.
1041
- *
1042
- * @param startHour
1043
- * @param startMinute
1044
- * @param endHour
1045
- * @param endMinute
1046
- * @returns
1047
- */
1048
- randomTime(startHour?: number, startMinute?: number, endHour?: number, endMinute?: number): DateTime;
1049
- /**
1050
- * Create a date for a given timestamp.
1051
- *
1052
- * @param timestamp - Unix timestamp
1053
- *
1054
- * @return {Date} object
1055
- */
1056
- static fromTimestamp(timestamp: number): DateTime;
1057
- /**
1058
- * Get current time instance.
1059
- *
1060
- * @returns Current time
1061
- */
1062
- static now(): DateTime;
1063
- /**
1064
- * Parse the time
1065
- *
1066
- * @param date
1067
- * @returns
1068
- */
1069
- static parse(date: dayjs.ConfigType): DateTime;
1070
- /**
1071
- * Get the formatted date according to the string of tokens passed in.
1072
- *
1073
- * To escape characters, wrap them in square brackets (e.g. [MM]).
1074
- *
1075
- * @param time - current time
1076
- * @param template - time format
1077
- */
1078
- static format(time?: ConfigType, template?: string | undefined): string;
1079
- /**
1080
- * Get the difference in days from today.
1081
- *
1082
- * @param time
1083
- * @param startHour
1084
- * @param startMinute
1085
- * @param endHour
1086
- * @param endMinute
1087
- * @returns
1088
- */
1089
- static randomTime(time?: ConfigType, startHour?: number, startMinute?: number, endHour?: number, endMinute?: number): DateTime;
1090
- /**
1091
- * Get the first day of the month of the given date
1092
- *
1093
- * @param time
1094
- *
1095
- * @returns
1096
- */
1097
- static firstDayOfMonth(time: ConfigType): DateTime;
1098
- /**
1099
- * Get the last day of the month of the given date
1100
- *
1101
- * @param time
1102
- *
1103
- * @returns
1104
- */
1105
- static lastDayOfMonth(time: ConfigType): DateTime;
1106
- }
1107
- //#endregion
1108
1043
  //#region src/Helpers/Str.d.ts
1109
1044
  declare enum Mode {
1110
1045
  MB_CASE_UPPER = 0,