@contentrain/astro-kit 0.34.3 → 0.35.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.
package/catalog.json CHANGED
@@ -4566,6 +4566,10 @@
4566
4566
  "type": "string",
4567
4567
  "description": "Locale the date is written in (site.language)."
4568
4568
  },
4569
+ "timeZone": {
4570
+ "type": "string",
4571
+ "description": "Time zone the date is read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
4572
+ },
4569
4573
  "image": {
4570
4574
  "type": "object",
4571
4575
  "fields": {
@@ -4804,6 +4808,11 @@
4804
4808
  "content": false,
4805
4809
  "description": "BCP 47 locale the dates are written in (site.language)."
4806
4810
  },
4811
+ "timeZone": {
4812
+ "type": "string",
4813
+ "content": false,
4814
+ "description": "Time zone the dates are read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
4815
+ },
4807
4816
  "surface": {
4808
4817
  "type": "string",
4809
4818
  "content": false,
@@ -44,6 +44,8 @@ interface Props {
44
44
  date?: Date | string | undefined
45
45
  /** BCP 47 locale the date is written in (site.language). */
46
46
  locale?: string | undefined
47
+ /** The time zone the date is read in (the site's, an IANA name or a `±hh:mm` offset); absent, UTC. */
48
+ timeZone?: string | undefined
47
49
  image?: ImageInput | undefined
48
50
  category?: LinkInput | undefined
49
51
  author?: string | undefined
@@ -63,11 +65,11 @@ interface Props {
63
65
  imageAspect?: string | undefined
64
66
  }
65
67
 
66
- const { title, href, excerpt, date: rawDate, locale = 'en', image, category, author, headingLevel = 2, layout, surface, byline, linkTitle, excerptLines, sizes, imageHeight, imageAspect } = Astro.props
68
+ const { title, href, excerpt, date: rawDate, locale = 'en', timeZone = 'UTC', image, category, author, headingLevel = 2, layout, surface, byline, linkTitle, excerptLines, sizes, imageHeight, imageAspect } = Astro.props
67
69
  const date = rawDate === undefined ? undefined : new Date(rawDate)
68
70
  const slots = card({ layout, surface, byline })
69
71
  const below = byline === 'below'
70
- const shown = date?.toLocaleDateString(locale, { dateStyle: 'long', timeZone: 'UTC' })
72
+ const shown = date?.toLocaleDateString(locale, { dateStyle: 'long', timeZone })
71
73
  const imageStyle = imageHeight ? `height:${imageHeight}` : imageAspect ? `aspect-ratio:${imageAspect}` : undefined
72
74
  const Heading = `h${headingLevel}` as 'h2' | 'h3'
73
75
  ---
@@ -16,6 +16,7 @@
16
16
  "excerpt": { "type": "text", "description": "Summary (posts.excerpt)." },
17
17
  "date": { "type": "datetime", "description": "Publication date (posts.published_at)." },
18
18
  "locale": { "type": "string", "description": "Locale the date is written in (site.language)." },
19
+ "timeZone": { "type": "string", "description": "Time zone the date is read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC." },
19
20
  "image": { "type": "object", "fields": { "src": { "type": "image", "required": true }, "alt": { "type": "string", "required": true }, "width": { "type": "integer" }, "height": { "type": "integer" } }, "description": "Cover (posts.cover → media)." },
20
21
  "category": { "type": "object", "fields": { "label": { "type": "string", "required": true }, "href": { "type": "url", "required": true } }, "description": "Primary category and its archive." },
21
22
  "author": { "type": "string", "description": "Author name (posts.author → authors.name)." },
@@ -61,6 +61,8 @@ interface Props {
61
61
  excerptLines?: 2 | 3 | 4 | undefined
62
62
  /** BCP 47 locale the dates are written in. */
63
63
  locale?: string | undefined
64
+ /** The time zone the dates are read in (the site's: an IANA name or a `±hh:mm` offset); absent, UTC. */
65
+ timeZone?: string | undefined
64
66
  /** Card surface: none, or each post its own card. */
65
67
  surface?: 'plain' | 'card' | undefined
66
68
  /** Where the full archive lives; with `moreLabel` a link follows the list. */
@@ -72,7 +74,7 @@ interface Props {
72
74
  id?: string | undefined
73
75
  }
74
76
 
75
- const { heading, intro, posts, layout = 'grid', columns, showImage = true, showExcerpt = true, showAuthor = true, showCategory = true, excerptLines, locale, surface, moreHref, moreLabel, tone, measured, id = 'posts' } = Astro.props
77
+ const { heading, intro, posts, layout = 'grid', columns, showImage = true, showExcerpt = true, showAuthor = true, showCategory = true, excerptLines, locale, timeZone, surface, moreHref, moreLabel, tone, measured, id = 'posts' } = Astro.props
76
78
  const s = list({ layout, columns })
77
79
  const headingId = heading ? `${id}-title` : undefined
78
80
  // Cards sit one heading level under the section's; with no section heading they are the page's h2s.
@@ -98,6 +100,7 @@ const cardLayout = (i: number) => layout === 'compact' ? 'minimal' : layout ===
98
100
  excerpt={showExcerpt && layout !== 'compact' ? post.excerpt : undefined}
99
101
  date={post.date}
100
102
  locale={locale}
103
+ timeZone={timeZone}
101
104
  image={showImage && layout !== 'compact' ? post.image : undefined}
102
105
  category={showCategory && layout !== 'compact' ? post.category : undefined}
103
106
  author={showAuthor && layout !== 'compact' ? post.author : undefined}
@@ -141,6 +141,11 @@
141
141
  "content": false,
142
142
  "description": "BCP 47 locale the dates are written in (site.language)."
143
143
  },
144
+ "timeZone": {
145
+ "type": "string",
146
+ "content": false,
147
+ "description": "Time zone the dates are read in (the site's: an IANA name or a ±hh:mm offset); absent, UTC."
148
+ },
144
149
  "surface": {
145
150
  "type": "string",
146
151
  "content": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.34.3",
3
+ "version": "0.35.0",
4
4
  "license": "MIT",
5
5
  "description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
6
6
  "type": "module",