forked from dasch-swiss/beol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove calendar package & integrate it directly
- Loading branch information
Showing
27 changed files
with
2,357 additions
and
12,919 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...n/select-property/specify-property-value/search-date-value/search-date-value.component.ts
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
6 changes: 3 additions & 3 deletions
6
src/app/dsp-ui-lib/viewer/values/date-value/calendar-header/calendar-header.component.ts
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
4 changes: 2 additions & 2 deletions
4
src/app/dsp-ui-lib/viewer/values/jdn-datepicker-directive/jdndatepicker.directive.ts
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,16 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { CalendarDate } from './lib/CalendarDate'; | ||
export { CalendarPeriod } from './lib/CalendarPeriod'; | ||
export { JDNPeriod } from './lib/JDNPeriod'; | ||
export { | ||
JDNConvertibleCalendar, | ||
GregorianCalendarDate, | ||
IslamicCalendarDate, | ||
JulianCalendarDate, | ||
} from './lib/JDNConvertibleCalendar'; | ||
export { JDNConvertibleConversionModule } from './lib/JDNCalendarConversion'; | ||
export { JDNConvertibleCalendarNames } from './lib/JDNCalendarNames'; |
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,43 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { JDNConvertibleCalendarError } from './JDNConvertibleCalendarError'; | ||
import { Utils } from './Utils'; | ||
|
||
/** | ||
* Represents a calendar date (calendar agnostic). | ||
* | ||
* Assumes that every supported calendar | ||
* can be represented by a combination of year, month, and day. | ||
* | ||
*/ | ||
export class CalendarDate { | ||
/** | ||
* | ||
* Please note that this software uses the (astronomical) convention that BCE dates are represented as negative years and that the year zero (0) is used. | ||
* The year 1 BCE must be indicated as year 0, and the year 2 BCE corresponds to -1 etc. | ||
* | ||
* @param year year of the given date. | ||
* @param month month of the given date. | ||
* @param day day of the given date (day of month, 1 based index). | ||
* @param dayOfWeek day of week of the given date (0 based index), if any. | ||
* @param daytime time of the day (0 - 0.9…), if any. 0 refers to midnight, 0.5 to noon, 0.9… to midnight of the same day. 1 would already refer to the next day and is thus not valid. | ||
*/ | ||
constructor( | ||
public readonly year: number, | ||
public readonly month: number, | ||
public readonly day: number, | ||
public readonly dayOfWeek?: number, | ||
public readonly daytime?: number | ||
) { | ||
// check validity of daytime | ||
if (daytime !== undefined && daytime >= 1) | ||
throw new JDNConvertibleCalendarError(`Invalid daytime: ${daytime}, valid range: 0 - 0.9…`); | ||
|
||
// TODO: When other calendar than Gregorian or Julian are implemented, this may have to be changed | ||
if (dayOfWeek !== undefined && (!Utils.isInteger(dayOfWeek) || dayOfWeek < 0 || dayOfWeek > 6)) | ||
throw new JDNConvertibleCalendarError(`Invalid day of week: ${dayOfWeek}`); | ||
} | ||
} |
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,23 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* Represents a period as two calendar dates. | ||
*/ | ||
import { CalendarDate } from './CalendarDate'; | ||
|
||
export class CalendarPeriod { | ||
/** | ||
* | ||
* @param periodStart start of the period. | ||
* @param periodEnd End of the period. | ||
*/ | ||
constructor( | ||
public readonly periodStart: CalendarDate, | ||
public readonly periodEnd: CalendarDate | ||
) { | ||
// TODO: can we check that periodStart equals or is before periodEnd? | ||
} | ||
} |
Oops, something went wrong.