-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(octra): sort projects by name ascending
- Loading branch information
1 parent
0f58bd7
commit f159067
Showing
8 changed files
with
163 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { DateTime } from 'luxon'; | ||
|
||
@Pipe({ | ||
name: 'luxonShortDateTime', | ||
standalone: true, | ||
}) | ||
export class LuxonShortDateTimePipe implements PipeTransform { | ||
constructor() {} | ||
|
||
transform( | ||
value: string | Date | DateTime | number | undefined, | ||
options: { locale: string | undefined } | ||
): unknown { | ||
if (!value) { | ||
return ''; | ||
} | ||
|
||
let dateTime: DateTime; | ||
|
||
if (value instanceof Date) { | ||
dateTime = DateTime.fromJSDate(value); | ||
} else if (value instanceof DateTime) { | ||
dateTime = value; | ||
} else if (typeof value === 'string') { | ||
dateTime = DateTime.fromISO(value); | ||
} else { | ||
dateTime = DateTime.fromMillis(value); | ||
} | ||
|
||
const loc = options.locale ?? 'en-GB'; | ||
return dateTime.toLocaleString( | ||
{ | ||
...DateTime.DATETIME_SHORT, | ||
day: '2-digit', | ||
month: '2-digit', | ||
year: '2-digit', | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
timeZoneName: 'short', | ||
}, | ||
{ | ||
locale: loc, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters