@reuters-graphics/graphics-components 3.3.2 → 3.3.3
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/components/Byline/Byline.svelte +1 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +6 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- @component `Byline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-text-elements-byline--docs) -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import { getAuthorPageUrl } from '../../utils';
|
|
3
|
+
import { getAuthorPageUrl, formatTime } from '../../utils';
|
|
4
4
|
import Block from '../Block/Block.svelte';
|
|
5
5
|
import { apdate } from 'journalize';
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
@@ -74,13 +74,6 @@
|
|
|
74
74
|
return true;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const formatTime = (datetime: string) =>
|
|
78
|
-
new Date(datetime).toLocaleTimeString([], {
|
|
79
|
-
hour: '2-digit',
|
|
80
|
-
minute: '2-digit',
|
|
81
|
-
timeZoneName: 'short',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
77
|
const areSameDay = (first: Date, second: Date) =>
|
|
85
78
|
first.getFullYear() === second.getFullYear() &&
|
|
86
79
|
first.getMonth() === second.getMonth() &&
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as cssVariables } from './actions/cssVariables/index';
|
|
2
2
|
export { default as resizeObserver } from './actions/resizeObserver/index';
|
|
3
|
-
export { prettifyDate } from './utils/index';
|
|
3
|
+
export { prettifyDate, getAuthorPageUrl, formatTime } from './utils/index';
|
|
4
4
|
export { default as Analytics, registerPageview, } from './components/Analytics/Analytics.svelte';
|
|
5
5
|
export { default as Article } from './components/Article/Article.svelte';
|
|
6
6
|
export { default as BlogPost } from './components/BlogPost/BlogPost.svelte';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { default as cssVariables } from './actions/cssVariables/index';
|
|
3
3
|
export { default as resizeObserver } from './actions/resizeObserver/index';
|
|
4
4
|
// Utils
|
|
5
|
-
export { prettifyDate } from './utils/index';
|
|
5
|
+
export { prettifyDate, getAuthorPageUrl, formatTime } from './utils/index';
|
|
6
6
|
// Components
|
|
7
7
|
export { default as Analytics, registerPageview, } from './components/Analytics/Analytics.svelte';
|
|
8
8
|
export { default as Article } from './components/Article/Article.svelte';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -31,3 +31,5 @@ export declare const prettifyDate: (input: string) => string;
|
|
|
31
31
|
* @returns The slugified string.
|
|
32
32
|
*/
|
|
33
33
|
export declare const slugify: (str: string) => string;
|
|
34
|
+
/** Formats a datetime string into a localized time string with hour, minute, and time zone for the dateline */
|
|
35
|
+
export declare const formatTime: (datetime: string) => string;
|
package/dist/utils/index.js
CHANGED
|
@@ -86,3 +86,9 @@ const prettifyAmPm = (text) => {
|
|
|
86
86
|
* @returns The slugified string.
|
|
87
87
|
*/
|
|
88
88
|
export const slugify = (str) => slug(str, { lower: true, strict: true });
|
|
89
|
+
/** Formats a datetime string into a localized time string with hour, minute, and time zone for the dateline */
|
|
90
|
+
export const formatTime = (datetime) => new Date(datetime).toLocaleTimeString([], {
|
|
91
|
+
hour: '2-digit',
|
|
92
|
+
minute: '2-digit',
|
|
93
|
+
timeZoneName: 'short',
|
|
94
|
+
});
|