@gobrand/tiempo 2.1.4 → 2.2.0

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.
@@ -0,0 +1,13 @@
1
+ // src/getToday.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function getToday(timezone) {
4
+ if (timezone) {
5
+ return Temporal.Now.zonedDateTimeISO(timezone).toPlainDate();
6
+ }
7
+ return Temporal.Now.plainDateISO();
8
+ }
9
+
10
+ export {
11
+ getToday
12
+ };
13
+ //# sourceMappingURL=chunk-ANLD6IWG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/getToday.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Get today's date in the system's local timezone or a specified timezone.\n *\n * @param timezone - Optional IANA timezone identifier (e.g., \"America/Asuncion\", \"Europe/Madrid\") or \"UTC\"\n * @returns A Temporal.PlainDate representing today's date\n *\n * @example\n * ```typescript\n * // Get today in local timezone\n * const today = getToday();\n *\n * // Get today in Madrid\n * const todayInMadrid = getToday(\"Europe/Madrid\");\n *\n * // Get today in UTC\n * const todayUtc = getToday(\"UTC\");\n * ```\n */\nexport function getToday(timezone?: \"UTC\" | string): Temporal.PlainDate {\n if (timezone) {\n return Temporal.Now.zonedDateTimeISO(timezone).toPlainDate();\n }\n return Temporal.Now.plainDateISO();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAoBlB,SAAS,SAAS,UAA+C;AACtE,MAAI,UAAU;AACZ,WAAO,SAAS,IAAI,iBAAiB,QAAQ,EAAE,YAAY;AAAA,EAC7D;AACA,SAAO,SAAS,IAAI,aAAa;AACnC;","names":[]}
@@ -0,0 +1,21 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Get today's date in the system's local timezone or a specified timezone.
4
+ *
5
+ * @param timezone - Optional IANA timezone identifier (e.g., "America/Asuncion", "Europe/Madrid") or "UTC"
6
+ * @returns A Temporal.PlainDate representing today's date
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Get today in local timezone
11
+ * const today = getToday();
12
+ *
13
+ * // Get today in Madrid
14
+ * const todayInMadrid = getToday("Europe/Madrid");
15
+ *
16
+ * // Get today in UTC
17
+ * const todayUtc = getToday("UTC");
18
+ * ```
19
+ */
20
+ export declare function getToday(timezone?: "UTC" | string): Temporal.PlainDate;
21
+ //# sourceMappingURL=getToday.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getToday.d.ts","sourceRoot":"","sources":["../src/getToday.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC,SAAS,CAKtE"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ getToday
3
+ } from "./chunk-ANLD6IWG.js";
4
+ export {
5
+ getToday
6
+ };
7
+ //# sourceMappingURL=getToday.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getToday.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getToday.test.d.ts","sourceRoot":"","sources":["../src/getToday.test.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { toZonedTime } from './toZonedTime';
2
2
  export { toUtc } from './toUtc';
3
3
  export { toUtcString } from './toUtcString';
4
4
  export { format, type FormatOptions } from './format';
5
+ export { getToday } from './getToday';
5
6
  export { startOfDay } from './startOfDay';
6
7
  export { endOfDay } from './endOfDay';
7
8
  export { startOfWeek } from './startOfWeek';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM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aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,12 @@
1
+ import {
2
+ toUtcString
3
+ } from "./chunk-DMKGJY4N.js";
1
4
  import {
2
5
  toZonedTime
3
6
  } from "./chunk-KD5GEHUA.js";
7
+ import {
8
+ isBefore
9
+ } from "./chunk-IPJUERCK.js";
4
10
  import {
5
11
  isSameDay
6
12
  } from "./chunk-RW3C2677.js";
@@ -19,9 +25,6 @@ import {
19
25
  import {
20
26
  toUtc
21
27
  } from "./chunk-GPAFAHKJ.js";
22
- import {
23
- toUtcString
24
- } from "./chunk-DMKGJY4N.js";
25
28
  import {
26
29
  endOfDay
27
30
  } from "./chunk-CUMB4776.js";
@@ -38,12 +41,12 @@ import "./chunk-AVGNRINZ.js";
38
41
  import {
39
42
  format
40
43
  } from "./chunk-2G5RJGPR.js";
44
+ import {
45
+ getToday
46
+ } from "./chunk-ANLD6IWG.js";
41
47
  import {
42
48
  isAfter
43
49
  } from "./chunk-BBNNR2QH.js";
44
- import {
45
- isBefore
46
- } from "./chunk-IPJUERCK.js";
47
50
  import "./chunk-MJSZNWCV.js";
48
51
  export {
49
52
  endOfDay,
@@ -51,6 +54,7 @@ export {
51
54
  endOfWeek,
52
55
  endOfYear,
53
56
  format,
57
+ getToday,
54
58
  isAfter,
55
59
  isBefore,
56
60
  isSameDay,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "description": "Lightweight utility functions for converting between UTC and timezone-aware datetimes using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {