vira 31.25.0 → 31.25.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.
@@ -17,6 +17,13 @@ export declare const ViraAbsoluteTime: import("element-vir").DeclarativeElementD
17
17
  * time of day would be meaningless noise.
18
18
  */
19
19
  dateOnly: boolean;
20
+ /**
21
+ * Timezone the value is displayed in. Defaults to the user's timezone. Set this for values
22
+ * that are conceptually anchored to a specific timezone (e.g. a date-only value stored at
23
+ * midnight UTC), where converting to the user's timezone would shift the displayed
24
+ * date/time.
25
+ */
26
+ timezone: string;
20
27
  }>, {}, {}, "vira-absolute-time-", "vira-absolute-time-", readonly [], readonly []>;
21
28
  /**
22
29
  * Formats a `FullDate` into the same absolute string rendered by {@link ViraAbsoluteTime}.
@@ -25,4 +32,5 @@ export declare const ViraAbsoluteTime: import("element-vir").DeclarativeElementD
25
32
  */
26
33
  export declare function formatAbsoluteTime(time: Readonly<FullDate>, options?: Readonly<PartialWithUndefined<{
27
34
  dateOnly: boolean;
35
+ timezone: string;
28
36
  }>>): string;
@@ -1,4 +1,4 @@
1
- import { createFullDateInUserTimezone, toFormattedString } from 'date-vir';
1
+ import { createFullDate, createFullDateInUserTimezone, toFormattedString, } from 'date-vir';
2
2
  import { css } from 'element-vir';
3
3
  import { defineViraElement } from '../util/define-vira-element.js';
4
4
  /**
@@ -19,6 +19,7 @@ export const ViraAbsoluteTime = defineViraElement()({
19
19
  render({ inputs }) {
20
20
  return formatAbsoluteTime(inputs.time, {
21
21
  dateOnly: inputs.dateOnly,
22
+ timezone: inputs.timezone,
22
23
  });
23
24
  },
24
25
  });
@@ -28,5 +29,7 @@ export const ViraAbsoluteTime = defineViraElement()({
28
29
  * @category Time
29
30
  */
30
31
  export function formatAbsoluteTime(time, options) {
31
- return toFormattedString(createFullDateInUserTimezone(time), options?.dateOnly ? 'MMM d, yyyy' : 'MMM d, yyyy HH:mm ZZZZ');
32
+ return toFormattedString(options?.timezone
33
+ ? createFullDate(time, options.timezone)
34
+ : createFullDateInUserTimezone(time), options?.dateOnly ? 'MMM d, yyyy' : 'MMM d, yyyy HH:mm ZZZZ');
32
35
  }
@@ -79,6 +79,7 @@ export const ViraDateInput = defineViraElement()({
79
79
  <${ViraAbsoluteTime.assign({
80
80
  time: inputs.value,
81
81
  dateOnly: true,
82
+ timezone: inputs.timezone,
82
83
  })}></${ViraAbsoluteTime}>
83
84
  `
84
85
  : html `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "31.25.0",
3
+ "version": "31.25.1",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",