Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EDT-1500] Add date variable definition #460

Merged
merged 7 commits into from
Jun 7, 2024
6 changes: 5 additions & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ export type {
BooleanVariable,
NumberVariable,
ConnectorImageVariableSource,
DateVariable,
DateRestriction,
RelativeDate,
AbsoluteDate,
} from './types/VariableTypes';
export { VariableType } from './types/VariableTypes';
export { VariableType, Day } from './types/VariableTypes';

export type { Color, DocumentColor, ColorUpdate } from './types/ColorStyleTypes';

Expand Down
31 changes: 31 additions & 0 deletions packages/sdk/src/types/VariableTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export enum VariableType {
boolean = 'boolean',
group = 'group',
number = 'number',
date = 'date',
}

export interface Variable {
Expand Down Expand Up @@ -78,6 +79,36 @@ export interface NumberVariable extends Variable {
stepSize: number;
}

export interface DateVariable extends Variable {
value?: string;
displayFormat: string;
startDate?: DateRestriction;
endDate?: DateRestriction;
excludedDays: Day[];
}

export type LongTextVariable = ShortTextVariable;

export type GroupVariable = Variable;

export type DateRestriction = RelativeDate | AbsoluteDate;

export interface RelativeDate {
offset: number;
type: 'relative';
}

export interface AbsoluteDate {
value: string;
type: 'absolute';
}

export enum Day {
Monday = 'monday',
Tuesday = 'tuesday',
Wednesday = 'wednesday',
Thursday = 'thursday',
Friday = 'friday',
Saturday = 'saturday',
Sunday = 'sunday',
}
Loading