Skip to content

Commit

Permalink
Merge pull request #225 from ilri/daterange-fix
Browse files Browse the repository at this point in the history
Daterange fix
  • Loading branch information
alanorth authored Jan 25, 2024
2 parents b3548fc + 31d6ee7 commit c739a9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ backend/.env

# Ignore rtx version files
.tool-versions
.idea/
backend/data/templates/migrated
11 changes: 10 additions & 1 deletion frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ export const ISO_8601_date_format = {
class PickDateAdapter extends NativeDateAdapter {
format(date: Date, displayFormat: string): string {
if (displayFormat === 'input') {
return formatDate(date, 'YYYY-MM-dd', this.locale);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString();
const day = date.getDate().toString();
return (
year +
'-' +
(month.length === 1 ? `0${month}` : month) +
'-' +
(day.length === 1 ? `0${day}` : day)
);
} else {
return date.toDateString();
}
Expand Down

0 comments on commit c739a9c

Please sign in to comment.