diff --git a/entry/src/main/ets/pages/Note.ts b/entry/src/main/ets/pages/Note.ts index 41270b2f7a894790516b6cc3f07f79642c02837c..0dd13172136cdb27685b7bae151a0979151f1b17 100644 --- a/entry/src/main/ets/pages/Note.ts +++ b/entry/src/main/ets/pages/Note.ts @@ -38,7 +38,7 @@ export class Note { @Columns({ columnName: "COMMENT", types: ColumnType.str }) comment: string @Columns({ columnName: "DATE", types: ColumnType.str }) - date: Date + date: string @Columns({ columnName: "TYPE", types: ColumnType.str }) type: string @Columns({ columnName: "MONEYS", types: ColumnType.real }) @@ -49,7 +49,7 @@ export class Note { id?: number, text?: string, comment?: string, - date?: Date, + date?: string, types?: string, moneys?: number ) { @@ -94,11 +94,11 @@ export class Note { this.comment = comment } - getDate(): Date { + getDate(): string { return this.date } - setDate(date: Date) { + setDate(date: string) { this.date = date } diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index f75b8953be7a6bedd15b2b86a91c148a1ae774b0..d0c180494727dee4bd34bca19d6e824ab2cb0ba9 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -79,7 +79,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) let predicates = new relationalStore.RdbPredicates("NOTE") @@ -178,7 +178,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) let predicates = new relationalStore.RdbPredicates("NOTE") @@ -267,12 +267,12 @@ export default function abilityTest() { let noteOne = new Note() noteOne.setText('abc1') noteOne.setComment(comment) - noteOne.setDate(new Date()) + noteOne.setDate(new Date().toString()) noteOne.setType(NoteType[NoteType.TEXT]) let noteTwo = new Note() noteTwo.setText('abc2') noteTwo.setComment(comment) - noteTwo.setDate(new Date()) + noteTwo.setDate(new Date().toString()) noteTwo.setType(NoteType[NoteType.TEXT]) let entities: Set = new Set() entities.add(noteOne) @@ -319,7 +319,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) let predicates = new relationalStore.RdbPredicates("NOTE") @@ -371,7 +371,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) note.setText('aaa') @@ -420,7 +420,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) let entityClass = GlobalContext.getContext().getValue("entityCls") as Record; @@ -470,7 +470,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(date) + note.setDate(date.toString()) note.setType(NoteType[NoteType.TEXT]) let date2 = new Date() @@ -478,7 +478,7 @@ export default function abilityTest() { let note2 = new Note() note2.setText('bbb') note2.setComment(comment2) - note2.setDate(date2) + note2.setDate(date2.toString()) note2.setType(NoteType[NoteType.TEXT]) await noteDao.insertInTxArrAsync(note, note2); let queryBuilder: QueryBuilder = noteDao.queryBuilder(); @@ -514,7 +514,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(date) + note.setDate(date.toString()) note.setType(NoteType[NoteType.TEXT]) await noteDao.insert(note) @@ -550,7 +550,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) let noteArr = new Array(); noteArr.push(note) @@ -612,7 +612,7 @@ export default function abilityTest() { let note = new Note() note.setText('abc') note.setComment(comment) - note.setDate(new Date()) + note.setDate(new Date().toString()) note.setType(NoteType[NoteType.TEXT]) let noteArr = new Array(); noteArr.push(note)