A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: limit changing created date to note's edited date
Ammar Ahmede7da0a35d3b7
diff --git a/apps/mobile/app/components/properties/date-meta.tsx b/apps/mobile/app/components/properties/date-meta.tsxindex 61d839cc8..8a5da0cba 100644--- a/apps/mobile/app/components/properties/date-meta.tsx+++ b/apps/mobile/app/components/properties/date-meta.tsx@@ -27,7 +27,7 @@ import { strings } from "@notesnook/intl";import { DefaultAppStyles } from "../../utils/styles";import DateTimePickerModal from "react-native-modal-datetime-picker";import { db } from "../../common/database";-import { Item } from "@notesnook/core";+import { Item, Note } from "@notesnook/core";import AppIcon from "../ui/AppIcon";export const DateMeta = ({ item }: { item: Item }) => {const { colors, isDark } = useThemeColors();@@ -67,9 +67,13 @@ export const DateMeta = ({ item }: { item: Item }) => {<Paragraphsize={AppFontSize.xs}color={colors.secondary.paragraph}- onPress={() => {- setIsDatePickerVisible(true);- }}+ onPress={+ item.type !== "note"+ ? undefined+ : () => {+ setIsDatePickerVisible(true);+ }+ }>{getFormattedDate(key === "dateCreated"@@ -77,7 +81,7 @@ export const DateMeta = ({ item }: { item: Item }) => {: (item[key as keyof Item] as string),"date-time")}- {key === "dateCreated" ? (+ {key === "dateCreated" && item.type === "note" ? (<>{" "}<AppIcon name="pencil" size={AppFontSize.md} />@@ -89,24 +93,28 @@ export const DateMeta = ({ item }: { item: Item }) => {return (<>- <DateTimePickerModal- isVisible={isDatePickerVisible}- mode="datetime"- onConfirm={async (date: Date) => {- await db.notes.add({- id: item.id,- dateCreated: date.getTime()- });- setDateCreated(date.getTime());- setIsDatePickerVisible(false);- }}- onCancel={() => {- setIsDatePickerVisible(false);- }}- isDarkModeEnabled={isDark}- is24Hour={db.settings.getTimeFormat() === "24-hour"}- date={new Date(dateCreated)}- />+ {item.type === "note" ? (+ <DateTimePickerModal+ isVisible={isDatePickerVisible}+ mode="datetime"+ onConfirm={async (date: Date) => {+ await db.notes.add({+ id: item.id,+ dateCreated: date.getTime()+ });+ setDateCreated(date.getTime());+ setIsDatePickerVisible(false);+ }}+ onCancel={() => {+ setIsDatePickerVisible(false);+ }}+ maximumDate={new Date((item as Note).dateEdited)}+ isDarkModeEnabled={isDark}+ is24Hour={db.settings.getTimeFormat() === "24-hour"}+ date={new Date(dateCreated)}+ />+ ) : null}+<Viewstyle={{borderTopWidth: 1,