Skip to content

Commit c9ab137

Browse files
authored
Merge pull request #310 from UiPath/fix/luxon_formatting
Fix/luxon formatting
2 parents 352e620 + eca2c22 commit c9ab137

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v14.4.0 (2023-02-13)
2+
* **dateformat** fixes default luxon formatting
3+
14
# v14.3.0 (2023-02-08)
25
* **playground** showcase custom value template support
36
* **suggest** add custom value template support

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-components",
3-
"version": "14.3.0",
3+
"version": "14.4.0",
44
"author": {
55
"name": "UiPath Inc",
66
"url": "https://uipath.com"

projects/angular/directives/ui-dateformat/src/ui-dateformat.directive.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class UiDateFormatDirective extends UiFormatDirective {
180180
}
181181
/**
182182
* The 'moment' format defaults to 'L LTS'.
183-
* The `luxon` format defaults to `DateTime.DATETIME_SHORT.
183+
* The `luxon` format defaults to `DateTime.DATETIME_SHORT_WITH_SECONDS.
184184
*
185185
*/
186186
@Input()
@@ -192,11 +192,11 @@ export class UiDateFormatDirective extends UiFormatDirective {
192192
if (!this.date) { return ''; }
193193
if (!(this.date instanceof Date)) { return this.date; }
194194

195-
const relativeTime = this._isMomentFormat(this.dateFormat)
196-
? moment(this.date)
197-
.fromNow()
198-
: DateTime.fromJSDate(this.date)
199-
.toRelative();
195+
const relativeTime = this._useLuxon
196+
? DateTime.fromJSDate(this.date)
197+
.toRelative()
198+
: moment(this.date)
199+
.fromNow();
200200

201201
return relativeTime ?? '';
202202
}
@@ -244,7 +244,7 @@ export class UiDateFormatDirective extends UiFormatDirective {
244244
elementRef,
245245
);
246246

247-
const defaultFormat = this._useLuxon ? DateTime.DATETIME_SHORT : 'L LTS';
247+
const defaultFormat = this._useLuxon ? DateTime.DATETIME_SHORT_WITH_SECONDS : 'L LTS';
248248

249249
this._options = _options || {};
250250
this.dateFormat = this._options.format ?? defaultFormat;

projects/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uipath/angular",
3-
"version": "14.3.0",
3+
"version": "14.4.0",
44
"license": "MIT",
55
"author": {
66
"name": "UiPath Inc",

0 commit comments

Comments
 (0)