1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-30 13:03:53 +01:00

standardize date types

This commit is contained in:
Kyle Spearrin 2018-08-20 16:20:51 -04:00
parent d0c51bacfd
commit 9bd8b73e27
9 changed files with 22 additions and 19 deletions

View File

@ -4,7 +4,7 @@ export class LoginApi {
uris: LoginUriApi[];
username: string;
password: string;
passwordRevisionDate?: Date;
passwordRevisionDate: string;
totp: string;
constructor(data: any) {

View File

@ -6,7 +6,7 @@ export class LoginData {
uris: LoginUriData[];
username: string;
password: string;
passwordRevisionDate?: Date;
passwordRevisionDate: string;
totp: string;
constructor(data?: LoginApi) {

View File

@ -20,7 +20,7 @@ export class Login extends Domain {
return;
}
this.passwordRevisionDate = obj.passwordRevisionDate;
this.passwordRevisionDate = obj.passwordRevisionDate != null ? new Date(obj.passwordRevisionDate) : null;
this.buildDomainModel(this, obj, {
username: null,
password: null,
@ -55,7 +55,7 @@ export class Login extends Domain {
toLoginData(): LoginData {
const l = new LoginData();
l.passwordRevisionDate = this.passwordRevisionDate;
l.passwordRevisionDate = this.passwordRevisionDate != null ? this.passwordRevisionDate.toISOString() : null;
this.buildDataModel(this, l, {
username: null,
password: null,

View File

@ -39,7 +39,8 @@ export class CipherRequest {
uris: null,
username: cipher.login.username ? cipher.login.username.encryptedString : null,
password: cipher.login.password ? cipher.login.password.encryptedString : null,
passwordRevisionDate: cipher.login.passwordRevisionDate,
passwordRevisionDate: cipher.login.passwordRevisionDate != null ?
cipher.login.passwordRevisionDate.toISOString() : null,
totp: cipher.login.totp ? cipher.login.totp.encryptedString : null,
};

View File

@ -9,7 +9,7 @@ export class BillingResponse {
upcomingInvoice: BillingInvoiceResponse;
charges: BillingChargeResponse[] = [];
license: any;
expiration: Date;
expiration: string;
constructor(response: any) {
this.storageName = response.StorageName;
@ -43,11 +43,11 @@ export class BillingSourceResponse {
}
export class BillingSubscriptionResponse {
trialStartDate: Date;
trialEndDate: Date;
periodStartDate: Date;
periodEndDate: Date;
cancelledDate: Date;
trialStartDate: string;
trialEndDate: string;
periodStartDate: string;
periodEndDate: string;
cancelledDate: string;
cancelAtEndDate: boolean;
status: string;
cancelled: boolean;
@ -83,7 +83,7 @@ export class BillingSubscriptionItemResponse {
}
export class BillingInvoiceResponse {
date: Date;
date: string;
amount: number;
constructor(response: any) {
@ -93,7 +93,7 @@ export class BillingInvoiceResponse {
}
export class BillingChargeResponse {
createdDate: Date;
createdDate: string;
amount: number;
paymentSource: BillingSourceResponse;
status: string;

View File

@ -1,13 +1,13 @@
export class BreachAccountResponse {
addedDate: Date;
breachDate: Date;
addedDate: string;
breachDate: string;
dataClasses: string[];
description: string;
domain: string;
isActive: boolean;
isVerified: boolean;
logoType: string;
modifiedDate: Date;
modifiedDate: string;
name: string;
pwnCount: number;
title: string;

View File

@ -10,7 +10,7 @@ export class EventResponse {
groupId: string;
organizationUserId: string;
actingUserId: string;
date: Date;
date: string;
deviceType: DeviceType;
ipAddress: string;

View File

@ -13,7 +13,7 @@ export class OrganizationBillingResponse extends OrganizationResponse {
subscription: BillingSubscriptionResponse;
upcomingInvoice: BillingInvoiceResponse;
charges: BillingChargeResponse[] = [];
expiration: Date;
expiration: string;
constructor(response: any) {
super(response);
@ -27,6 +27,6 @@ export class OrganizationBillingResponse extends OrganizationResponse {
if (response.Charges != null) {
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
}
this.expiration = response.Expiration != null ? new Date(response.Expiration) : null;
this.expiration = response.Expiration;
}
}

View File

@ -5,6 +5,7 @@ import { Folder } from '../domain/folder';
export class FolderView implements View {
id: string = null;
name: string;
revisionDate: Date;
constructor(f?: Folder) {
if (!f) {
@ -12,5 +13,6 @@ export class FolderView implements View {
}
this.id = f.id;
this.revisionDate = f.revisionDate;
}
}