@fuentis/phoenix-ui 0.0.9-alpha.672 → 0.0.9-alpha.674

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.
@@ -8728,7 +8728,8 @@ class MetaTimeperiodV2Component {
8728
8728
  this.value.set('');
8729
8729
  return;
8730
8730
  }
8731
- this.value.set(typeof v === 'string' ? v : timePeriodFromMS(v));
8731
+ // Milliseconds are shown in the user's language, the format the validator and the user's input use.
8732
+ this.value.set(typeof v === 'string' ? v : timePeriodFromMS(v, this.translate.currentLang));
8732
8733
  }
8733
8734
  registerOnChange(fn) {
8734
8735
  this.onChange = fn;
@@ -8860,6 +8861,7 @@ class ReadOnlyInputV2Component {
8860
8861
  form;
8861
8862
  /** Used to automatically unsubscribe from valueChanges on destroy */
8862
8863
  dr = inject(DestroyRef);
8864
+ translate = inject(TranslateService);
8863
8865
  /**
8864
8866
  * Internal reactive signal holding the current control value.
8865
8867
  * We keep a local signal to optimize OnPush change detection and computed selectors.
@@ -9057,6 +9059,13 @@ class ReadOnlyInputV2Component {
9057
9059
  if (this.type === 'ASSIGN' || this.type === 'ASSIGN_ASSET') {
9058
9060
  return this.assign()?.name ?? null;
9059
9061
  }
9062
+ // A duration is stored in milliseconds: shown as a period in the user's language ("1d 4h"), as the editable
9063
+ // field and the V1 read-only view show it; 0 is "not set".
9064
+ if (this.type === 'TIMEPERIOD') {
9065
+ if (typeof v === 'string')
9066
+ return v;
9067
+ return typeof v === 'number' && v > 0 ? timePeriodFromMS(v, this.translate.currentLang) : null;
9068
+ }
9060
9069
  // Text areas and editors often contain HTML
9061
9070
  if (this.type === 'TEXT_AREA' || this.type === 'TEXT_EDITOR') {
9062
9071
  return typeof v === 'string' ? v : String(v);