@angelrove/forecast-utils 1.1.5 → 1.1.6

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/README.md CHANGED
@@ -14,14 +14,15 @@
14
14
  ¡Solo proporcionar HORA LOCAL DEL SISTEMA!: 'new Date()'
15
15
  Con excepción de &#39;getSolarTime()&#39;: recibe la hora local correspondiente a la localización dada.</p>
16
16
  </dd>
17
- <dt><a href="#module_Astronomy/helpers">Astronomy/helpers</a></dt>
18
- <dd></dd>
19
17
  <dt><a href="#module_Geolocation">Geolocation</a></dt>
20
18
  <dd></dd>
21
19
  <dt><a href="#module_OpenMeteo">OpenMeteo</a></dt>
22
20
  <dd></dd>
23
21
  <dt><a href="#module_Utils">Utils</a></dt>
24
22
  <dd></dd>
23
+ <dt><a href="#module_Utils/TimeDateStr">Utils/TimeDateStr</a></dt>
24
+ <dd><p>Helpers for get date and time formeted strings</p>
25
+ </dd>
25
26
  </dl>
26
27
 
27
28
  <a name="module_Astronomy/MoonCalc"></a>
@@ -263,85 +264,36 @@ Con excepción de 'getSolarTime()': recibe la hora local correspondiente a la lo
263
264
 
264
265
  * * *
265
266
 
266
- <a name="module_Astronomy/helpers"></a>
267
-
268
- ## Astronomy/helpers
269
-
270
- * [Astronomy/helpers](#module_Astronomy/helpers)
271
- * [.exports.timeString([date], [sec])](#module_Astronomy/helpers.exports.timeString) ⇒ <code>string</code>
272
- * [.exports.nowString(sec)](#module_Astronomy/helpers.exports.nowString) ⇒ <code>String</code>
273
- * [.exports.dateFormat([date])](#module_Astronomy/helpers.exports.dateFormat) ⇒ <code>string</code>
274
- * [.exports.getLocalTimeFromTz(timeZone, [date])](#module_Astronomy/helpers.exports.getLocalTimeFromTz) ⇒ <code>string</code>
275
- * [.exports.getLocalTimeInfo(apiKey, lat, lng)](#module_Astronomy/helpers.exports.getLocalTimeInfo) ⇒ <code>Promise.&lt;(any\|LocalTimeData)&gt;</code>
276
-
277
-
278
- * * *
279
-
280
- <a name="module_Astronomy/helpers.exports.timeString"></a>
281
-
282
- ### Astronomy/helpers.exports.timeString([date], [sec]) ⇒ <code>string</code>
283
- Formatea una fecha a un string legible.
284
-
285
- **Kind**: static method of [<code>Astronomy/helpers</code>](#module_Astronomy/helpers)
286
- **Returns**: <code>string</code> - La fecha formateada.
287
-
288
- | Param | Type | Default |
289
- | --- | --- | --- |
290
- | [date] | <code>Date</code> | |
291
- | [sec] | <code>boolean</code> | <code>false</code> |
292
-
293
-
294
- * * *
295
-
296
- <a name="module_Astronomy/helpers.exports.nowString"></a>
297
-
298
- ### Astronomy/helpers.exports.nowString(sec) ⇒ <code>String</code>
299
- **Kind**: static method of [<code>Astronomy/helpers</code>](#module_Astronomy/helpers)
300
-
301
- | Param | Type |
302
- | --- | --- |
303
- | sec | <code>boolean</code> |
304
-
305
-
306
- * * *
307
-
308
- <a name="module_Astronomy/helpers.exports.dateFormat"></a>
309
-
310
- ### Astronomy/helpers.exports.dateFormat([date]) ⇒ <code>string</code>
311
- Formatea una fecha a un string legible.
267
+ <a name="module_Geolocation"></a>
312
268
 
313
- **Kind**: static method of [<code>Astronomy/helpers</code>](#module_Astronomy/helpers)
314
- **Returns**: <code>string</code> - La fecha formateada.
269
+ ## Geolocation
315
270
 
316
- | Param | Type | Default | Description |
317
- | --- | --- | --- | --- |
318
- | [date] | <code>Date</code> | <code>new Date()</code> | La fecha a formatear. |
271
+ * [Geolocation](#module_Geolocation)
272
+ * [.exports.getGeolocation()](#module_Geolocation.exports.getGeolocation) <code>Promise.&lt;{latitude: number, longitude: number, formatted\_address: string}&gt;</code>
273
+ * [.exports.timeFromLocation(apiKey, lat, lng)](#module_Geolocation.exports.timeFromLocation) <code>Promise.&lt;(any\|LocalTimeData)&gt;</code>
319
274
 
320
275
 
321
276
  * * *
322
277
 
323
- <a name="module_Astronomy/helpers.exports.getLocalTimeFromTz"></a>
278
+ <a name="module_Geolocation.exports.getGeolocation"></a>
324
279
 
325
- ### Astronomy/helpers.exports.getLocalTimeFromTz(timeZone, [date]) ⇒ <code>string</code>
326
- Get local time from timezone
280
+ ### Geolocation.exports.getGeolocation() ⇒ <code>Promise.&lt;{latitude: number, longitude: number, formatted\_address: string}&gt;</code>
281
+ Get the current geolocation of the device and reverse geocode it to get the address.
327
282
 
328
- **Kind**: static method of [<code>Astronomy/helpers</code>](#module_Astronomy/helpers)
329
- **Returns**: <code>string</code> - - The formatted local time string.
283
+ **Kind**: static method of [<code>Geolocation</code>](#module_Geolocation)
284
+ **Throws**:
330
285
 
331
- | Param | Type | Default | Description |
332
- | --- | --- | --- | --- |
333
- | timeZone | <code>string</code> | | The timezone string (e.g., 'America/New_York'). |
334
- | [date] | <code>Date</code> \| <code>number</code> | <code>new Date()</code> | The date object to format. Defaults to the current date. |
286
+ - <code>Error</code> If geolocation is not supported or permission is denied.
335
287
 
336
288
 
337
289
  * * *
338
290
 
339
- <a name="module_Astronomy/helpers.exports.getLocalTimeInfo"></a>
291
+ <a name="module_Geolocation.exports.timeFromLocation"></a>
340
292
 
341
- ### Astronomy/helpers.exports.getLocalTimeInfo(apiKey, lat, lng) ⇒ <code>Promise.&lt;(any\|LocalTimeData)&gt;</code>
342
- Get local time from any location using Google Maps TimeZone API.
293
+ ### Geolocation.exports.timeFromLocation(apiKey, lat, lng) ⇒ <code>Promise.&lt;(any\|LocalTimeData)&gt;</code>
294
+ Get local time from a given location (lat, lng) using 'GoogleMaps TimeZone' API.
343
295
 
344
- **Kind**: static method of [<code>Astronomy/helpers</code>](#module_Astronomy/helpers)
296
+ **Kind**: static method of [<code>Geolocation</code>](#module_Geolocation)
345
297
  **Returns**: <code>Promise.&lt;(any\|LocalTimeData)&gt;</code> - - An object containing the local time and timezone information:
346
298
  **Throws**:
347
299
 
@@ -355,25 +307,6 @@ Get local time from any location using Google Maps TimeZone API.
355
307
  | lng | <code>number</code> | |
356
308
 
357
309
 
358
- * * *
359
-
360
- <a name="module_Geolocation"></a>
361
-
362
- ## Geolocation
363
-
364
- * * *
365
-
366
- <a name="module_Geolocation.exports.getGeolocation"></a>
367
-
368
- ### Geolocation.exports.getGeolocation() ⇒ <code>Promise.&lt;{latitude: number, longitude: number, formatted\_address: string}&gt;</code>
369
- Get the current geolocation of the device and reverse geocode it to get the address.
370
-
371
- **Kind**: static method of [<code>Geolocation</code>](#module_Geolocation)
372
- **Throws**:
373
-
374
- - <code>Error</code> If geolocation is not supported or permission is denied.
375
-
376
-
377
310
  * * *
378
311
 
379
312
  <a name="module_OpenMeteo"></a>
@@ -466,6 +399,7 @@ Get weather symbol and description based on the weather code.
466
399
  * [.exports.degreesToCompass(degrees, language)](#module_Utils.exports.degreesToCompass) ⇒ <code>Object</code>
467
400
  * [.exports.getWarningByDays(precipitationSumToday, precipitationSumTomorrow, showersSumToday, showersSumTomorrow)](#module_Utils.exports.getWarningByDays) ⇒ <code>Object</code> \| <code>null</code>
468
401
  * [.exports.getWarning(precipitation, showers)](#module_Utils.exports.getWarning) ⇒ <code>Object</code> \| <code>null</code>
402
+ * [.exports.WindArrow(props)](#module_Utils.exports.WindArrow)
469
403
  * [.exports.windArrowTx(deg)](#module_Utils.exports.windArrowTx)
470
404
  * [.exports.getWindLevel(speed)](#module_Utils.exports.getWindLevel) ⇒ <code>WindLevel</code> \| <code>null</code>
471
405
  * [.Compass](#module_Utils.Compass) : <code>Object</code>
@@ -570,6 +504,30 @@ Get warning by precipitation and showers
570
504
  | showers | <code>number</code> |
571
505
 
572
506
 
507
+ * * *
508
+
509
+ <a name="module_Utils.exports.WindArrow"></a>
510
+
511
+ ### Utils.exports.WindArrow(props)
512
+ SVG arrow indicating wind direction.
513
+
514
+ **Kind**: static method of [<code>Utils</code>](#module_Utils)
515
+ **Component**: JSX
516
+
517
+ | Param | Type | Description |
518
+ | --- | --- | --- |
519
+ | props | <code>Object</code> | Component props. |
520
+
521
+ **Properties**
522
+
523
+ | Name | Type | Description |
524
+ | --- | --- | --- |
525
+ | props.deg | <code>number</code> | Wind direction in degrees (0 = North, 90 = East, etc.). |
526
+ | [props.size] | <code>string</code> | Tailwind CSS size class (e.g., 'size-10') |
527
+ | [props.strokeWidth] | <code>number</code> | Stroke width of the arrow (range: 1–6). |
528
+ | [props.className] | <code>string</code> | Additional CSS classes. |
529
+
530
+
573
531
  * * *
574
532
 
575
533
  <a name="module_Utils.exports.windArrowTx"></a>
@@ -648,3 +606,79 @@ Return the wind level based on the speed.
648
606
 
649
607
  * * *
650
608
 
609
+ <a name="module_Utils/TimeDateStr"></a>
610
+
611
+ ## Utils/TimeDateStr
612
+ Helpers for get date and time formeted strings
613
+
614
+
615
+ * [Utils/TimeDateStr](#module_Utils/TimeDateStr)
616
+ * [.dateFormat([date])](#module_Utils/TimeDateStr.dateFormat) ⇒ <code>string</code>
617
+ * [.timeString([date], [sec])](#module_Utils/TimeDateStr.timeString) ⇒ <code>string</code>
618
+ * [.nowString(sec)](#module_Utils/TimeDateStr.nowString) ⇒ <code>String</code>
619
+ * [.getLocalTimeFromTz(timeZone, [date])](#module_Utils/TimeDateStr.getLocalTimeFromTz) ⇒ <code>string</code>
620
+
621
+
622
+ * * *
623
+
624
+ <a name="module_Utils/TimeDateStr.dateFormat"></a>
625
+
626
+ ### Utils/TimeDateStr.dateFormat([date]) ⇒ <code>string</code>
627
+ Returns a date as a formated string.
628
+
629
+ **Kind**: static method of [<code>Utils/TimeDateStr</code>](#module_Utils/TimeDateStr)
630
+ **Returns**: <code>string</code> - La fecha formateada.
631
+
632
+ | Param | Type | Default | Description |
633
+ | --- | --- | --- | --- |
634
+ | [date] | <code>Date</code> | <code>new Date()</code> | La fecha a formatear. |
635
+
636
+
637
+ * * *
638
+
639
+ <a name="module_Utils/TimeDateStr.timeString"></a>
640
+
641
+ ### Utils/TimeDateStr.timeString([date], [sec]) ⇒ <code>string</code>
642
+ Returns a time as a formated string.
643
+
644
+ **Kind**: static method of [<code>Utils/TimeDateStr</code>](#module_Utils/TimeDateStr)
645
+ **Returns**: <code>string</code> - La fecha formateada.
646
+
647
+ | Param | Type | Default |
648
+ | --- | --- | --- |
649
+ | [date] | <code>Date</code> | |
650
+ | [sec] | <code>boolean</code> | <code>false</code> |
651
+
652
+
653
+ * * *
654
+
655
+ <a name="module_Utils/TimeDateStr.nowString"></a>
656
+
657
+ ### Utils/TimeDateStr.nowString(sec) ⇒ <code>String</code>
658
+ Returns a now time as a formated string.
659
+
660
+ **Kind**: static method of [<code>Utils/TimeDateStr</code>](#module_Utils/TimeDateStr)
661
+
662
+ | Param | Type | Default |
663
+ | --- | --- | --- |
664
+ | sec | <code>boolean</code> | <code>false</code> |
665
+
666
+
667
+ * * *
668
+
669
+ <a name="module_Utils/TimeDateStr.getLocalTimeFromTz"></a>
670
+
671
+ ### Utils/TimeDateStr.getLocalTimeFromTz(timeZone, [date]) ⇒ <code>string</code>
672
+ Return the local time string from a given timezone.
673
+
674
+ **Kind**: static method of [<code>Utils/TimeDateStr</code>](#module_Utils/TimeDateStr)
675
+ **Returns**: <code>string</code> - - The formatted local time string.
676
+
677
+ | Param | Type | Default | Description |
678
+ | --- | --- | --- | --- |
679
+ | timeZone | <code>string</code> | | The timezone string (e.g., 'America/New_York'). |
680
+ | [date] | <code>Date</code> \| <code>number</code> | <code>new Date()</code> | The date object to format. Defaults to the current date. |
681
+
682
+
683
+ * * *
684
+
@@ -10,7 +10,7 @@ declare namespace TimeDateStr {
10
10
  *
11
11
  * @param {Date} [date=new Date()] La fecha a formatear.
12
12
  * @returns {string} La fecha formateada.
13
- * @memberof module:Utils
13
+ * @memberof module:Utils/TimeDateStr
14
14
  */
15
15
  declare function dateFormat(date?: Date | undefined): string;
16
16
  /**
@@ -18,7 +18,7 @@ declare function dateFormat(date?: Date | undefined): string;
18
18
  *
19
19
  * @param {boolean} sec
20
20
  * @returns {String}
21
- * @memberof module:Utils
21
+ * @memberof module:Utils/TimeDateStr
22
22
  */
23
23
  declare function nowString(sec?: boolean): string;
24
24
  /**
@@ -27,7 +27,7 @@ declare function nowString(sec?: boolean): string;
27
27
  * @param {Date} [date]
28
28
  * @param {boolean} [sec=false]
29
29
  * @returns {string} La fecha formateada.
30
- * @memberof module:Utils
30
+ * @memberof module:Utils/TimeDateStr
31
31
  */
32
32
  declare function timeString(date?: Date | undefined, sec?: boolean | undefined): string;
33
33
  /**
@@ -36,6 +36,6 @@ declare function timeString(date?: Date | undefined, sec?: boolean | undefined):
36
36
  * @param {string} timeZone - The timezone string (e.g., 'America/New_York').
37
37
  * @param {Date | number} [date=new Date()] - The date object to format. Defaults to the current date.
38
38
  * @returns {string} - The formatted local time string.
39
- * @memberof module:Utils
39
+ * @memberof module:Utils/TimeDateStr
40
40
  */
41
41
  declare function getLocalTimeFromTz(timeZone: string, date?: number | Date | undefined): string;
@@ -2,32 +2,14 @@
2
2
  * Wind direction arrow component (svg image).
3
3
  */
4
4
  /**
5
- * @typedef {Object} WindArrowProps
6
- * @property {number} props.deg - Wind direction in degrees
7
- * @property {string} [props.size] - Size of the arrow (Tailwind CSS size: 'size-10')
8
- * @property {number} [props.strokeWidth] - Stroke width of the arrow (1 to 6)
9
- * @property {string} [props.className]
10
- */
11
- /**
12
- * Wind direction arrow component (svg image).
5
+ * SVG arrow indicating wind direction.
13
6
  *
14
- * @component
15
- * @param {WindArrowProps} props
7
+ * @component JSX
8
+ * @param {Object} props - Component props.
9
+ * @prop {number} props.deg - Wind direction in degrees (0 = North, 90 = East, etc.).
10
+ * @prop {string} [props.size] - Tailwind CSS size class (e.g., 'size-10')
11
+ * @prop {number} [props.strokeWidth] - Stroke width of the arrow (range: 1–6).
12
+ * @prop {string} [props.className] - Additional CSS classes.
16
13
  * @memberof module:Utils
17
14
  */
18
- export function WindArrow({ deg, size, strokeWidth, className, }: WindArrowProps): any;
19
- export type WindArrowProps = {
20
- /**
21
- * - Wind direction in degrees
22
- */
23
- deg: number;
24
- /**
25
- * - Size of the arrow (Tailwind CSS size: 'size-10')
26
- */
27
- size?: string;
28
- /**
29
- * - Stroke width of the arrow (1 to 6)
30
- */
31
- strokeWidth?: number;
32
- className?: string;
33
- };
15
+ export function WindArrow({ deg, size, strokeWidth, className, }: Object): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Jose Angel Romero Vegas",
3
3
  "name": "@angelrove/forecast-utils",
4
- "version": "1.1.5",
4
+ "version": "1.1.6",
5
5
  "description": "Utilities for obtaining weather and astronomy forecast data.",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Helpers for get date and time formeted strings
3
3
  *
4
+ * @module Utils/TimeDateStr
4
5
  */
5
6
 
6
7
  /**
@@ -21,7 +22,7 @@ export default TimeDateStr;
21
22
  *
22
23
  * @param {Date} [date=new Date()] La fecha a formatear.
23
24
  * @returns {string} La fecha formateada.
24
- * @memberof module:Utils
25
+ * @memberof module:Utils/TimeDateStr
25
26
  */
26
27
  function dateFormat(date = new Date()) {
27
28
  const options = {
@@ -39,7 +40,7 @@ function dateFormat(date = new Date()) {
39
40
  * @param {Date} [date]
40
41
  * @param {boolean} [sec=false]
41
42
  * @returns {string} La fecha formateada.
42
- * @memberof module:Utils
43
+ * @memberof module:Utils/TimeDateStr
43
44
  */
44
45
  function timeString(date = new Date(), sec = false) {
45
46
  if (sec) {
@@ -63,7 +64,7 @@ function timeString(date = new Date(), sec = false) {
63
64
  *
64
65
  * @param {boolean} sec
65
66
  * @returns {String}
66
- * @memberof module:Utils
67
+ * @memberof module:Utils/TimeDateStr
67
68
  */
68
69
  function nowString(sec = false) {
69
70
  return timeString(new Date(), sec);
@@ -75,7 +76,7 @@ function nowString(sec = false) {
75
76
  * @param {string} timeZone - The timezone string (e.g., 'America/New_York').
76
77
  * @param {Date | number} [date=new Date()] - The date object to format. Defaults to the current date.
77
78
  * @returns {string} - The formatted local time string.
78
- * @memberof module:Utils
79
+ * @memberof module:Utils/TimeDateStr
79
80
  */
80
81
  function getLocalTimeFromTz(timeZone, date = new Date()) {
81
82
  // Timezone example
@@ -1,20 +1,26 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Wind direction arrow component (svg image).
3
4
  */
4
5
 
5
- /**
6
- * @typedef {Object} WindArrowProps
7
- * @property {number} props.deg - Wind direction in degrees
8
- * @property {string} [props.size] - Size of the arrow (Tailwind CSS size: 'size-10')
9
- * @property {number} [props.strokeWidth] - Stroke width of the arrow (1 to 6)
10
- * @property {string} [props.className]
11
- */
6
+ // /**
7
+ // * @typedef {Object} WindArrowProps
8
+ // * @property {number} props.deg - Wind direction in degrees
9
+ // * @property {string} [props.size] - Size of the arrow (Tailwind CSS size: 'size-10')
10
+ // * @property {number} [props.strokeWidth] - Stroke width of the arrow (1 to 6)
11
+ // * @property {string} [props.className]
12
+ // * @memberof module:Utils
13
+ // */
12
14
 
13
15
  /**
14
- * Wind direction arrow component (svg image).
16
+ * SVG arrow indicating wind direction.
15
17
  *
16
- * @component
17
- * @param {WindArrowProps} props
18
+ * @component JSX
19
+ * @param {Object} props - Component props.
20
+ * @prop {number} props.deg - Wind direction in degrees (0 = North, 90 = East, etc.).
21
+ * @prop {string} [props.size] - Tailwind CSS size class (e.g., 'size-10')
22
+ * @prop {number} [props.strokeWidth] - Stroke width of the arrow (range: 1–6).
23
+ * @prop {string} [props.className] - Additional CSS classes.
18
24
  * @memberof module:Utils
19
25
  */
20
26
  export function WindArrow({