Skip to content

Commit

Permalink
Merge pull request #53 from skbkontur/a.dobrynin/datetimeoffset
Browse files Browse the repository at this point in the history
added DateTimeOffset support
  • Loading branch information
aldobrynin authored Nov 18, 2022
2 parents 0529cfd + 19072a5 commit 08fb140
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type SimpleNullableRootType = {
sByte?: null | number;
char?: null | string;
dateTime?: null | (Date | string);
dateTimeOffset?: null | (Date | string);
timeSpan?: null | string;
guid?: null | string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type SimpleRootType = {
char: string;
string?: null | string;
dateTime: (Date | string);
dateTimeOffset: (Date | string);
timeSpan: string;
guid: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type SimpleNullableRootType = {
sByte?: null | number;
char?: null | string;
dateTime?: null | (Date | string);
dateTimeOffset?: null | (Date | string);
timeSpan?: null | (number | string);
guid?: null | string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type SimpleRootType = {
char: string;
string?: null | string;
dateTime: (Date | string);
dateTimeOffset: (Date | string);
timeSpan: (number | string);
guid: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class SimpleNullableRootType
public sbyte? SByte { get; set; }
public char? Char { get; set; }
public DateTime? DateTime { get; set; }
public DateTimeOffset? DateTimeOffset { get; set; }
public TimeSpan? TimeSpan { get; set; }
public Guid? Guid { get; set; }
}
Expand Down
1 change: 1 addition & 0 deletions TypeScript.ContractGenerator.Tests/Types/SimpleRootType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class SimpleRootType
public char Char { get; set; }
public string String { get; set; }
public DateTime DateTime { get; set; }
public DateTimeOffset DateTimeOffset { get; set; }
public TimeSpan TimeSpan { get; set; }
public Guid Guid { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected override TypeScriptType ReferenceFromInternal(ITypeInfo type, TypeScri
{TypeInfo.From<double>(), "number"},
{TypeInfo.From<decimal>(), "number"},
{TypeInfo.From<DateTime>(), "(Date | string)"},
{TypeInfo.From<DateTimeOffset>(), "(Date | string)"},
{TypeInfo.From<TimeSpan>(), "(number | string)"},
{TypeInfo.From<string>(), "string"},
{TypeInfo.From<long>(), "number"},
Expand Down

0 comments on commit 08fb140

Please sign in to comment.