Skip to content

Commit

Permalink
Merge pull request #163 from dainst/exif_to_db_metadata
Browse files Browse the repository at this point in the history
Extend image metadata handling
  • Loading branch information
tkleinke authored Mar 22, 2024
2 parents 5910707 + ae6449c commit df0d47f
Show file tree
Hide file tree
Showing 32 changed files with 913 additions and 618 deletions.
2 changes: 1 addition & 1 deletion core/config/Library/Forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
"groups": [
{
"name": "stem",
"fields": ["identifier", "category", "shortDescription", "draughtsmen", "processor", "campaign"]
"fields": ["identifier", "category", "shortDescription", "draughtsmen", "processor", "campaign", "date"]
},
{
"name": "properties",
Expand Down
8 changes: 4 additions & 4 deletions core/src/services/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ProjectConfiguration } from './project-configuration';
import { CategoryForm } from '../model/configuration/category-form';
import { SortUtil } from '../tools/sort-util';
import { Relation } from '../model/configuration/relation';
import { Field } from '../model/configuration/field';


/**
Expand Down Expand Up @@ -59,10 +60,9 @@ export class Labels {

public getFieldLabel(category: CategoryForm, fieldName: string): string {

const label = CategoryForm.getField(category, fieldName);
if (!label) return undefined;

return I18N.getLabel(label, this.getLanguages());
const field: Field = CategoryForm.getField(category, fieldName);
if (!field) return undefined;
return I18N.getLabel(field, this.getLanguages());
}


Expand Down
8 changes: 8 additions & 0 deletions core/src/tools/format-date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function formatDate(date: Date): string {

const day: string = date.getDate().toString().padStart(2, '0');
const month: string = (date.getMonth() + 1).toString().padStart(2, '0');
const year: string = date.getFullYear().toString();

return `${day}.${month}.${year}`;
}
1 change: 1 addition & 0 deletions core/src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { SortUtil } from './sort-util';
export { StringUtils } from './string-utils';
export { addKeyAsProp, makeLookup, mapToArray } from './transformers';
export { parseDate } from './parse-date';
export { formatDate } from './format-date';
export { InvalidDataUtil } from './invalid-data-util';
export * from './utils';
export * from './valuelist-util';
Expand Down
14 changes: 14 additions & 0 deletions core/test/tools/format-date.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { formatDate } from '../../src/tools/format-date';


/**
* @author Thomas Kleinke
*/
describe('formatDate', () => {

it('format dates', () => {

expect(formatDate(new Date(2010, 5, 2))).toEqual('02.06.2010');
expect(formatDate(new Date(1998, 9, 20))).toEqual('20.10.1998');
});
});
Loading

0 comments on commit df0d47f

Please sign in to comment.