5454 </template >
5555 </NcActionButton >
5656
57- <NcActionButton :aria-label =" t('memories', 'Go to date')" @click =" openDatePicker()" close-after-click >
58- {{ t('memories', 'Go to date') }}
59- <template #icon > <CalendarSearchIcon :size =" 20" /> </template >
60- </NcActionButton >
6157 </NcActions >
6258
63- <input ref =" dateInput" type =" date" class =" date-input-hidden" @change =" onDateSelected" />
59+ <NcDateTimePicker
60+ v-model =" goToDate"
61+ type =" date"
62+ :clearable =" false"
63+ :placeholder =" t('memories', 'Go to date')"
64+ @change =" onDateSelected"
65+ />
6466 </div >
6567 </div >
6668</template >
@@ -74,6 +76,7 @@ const NcBreadcrumbs = () => import('@nextcloud/vue/dist/Components/NcBreadcrumbs
7476const NcBreadcrumb = () => import (' @nextcloud/vue/dist/Components/NcBreadcrumb.js' );
7577import NcActions from ' @nextcloud/vue/dist/Components/NcActions.js' ;
7678import NcActionButton from ' @nextcloud/vue/dist/Components/NcActionButton.js' ;
79+ import NcDateTimePicker from ' @nextcloud/vue/dist/Components/NcDateTimePicker.js' ;
7780import PublicUploadHandler from ' @components/upload/PublicUploadHandler.vue' ;
7881
7982import * as utils from ' @services/utils' ;
@@ -84,7 +87,6 @@ import ShareIcon from 'vue-material-design-icons/ShareVariant.vue';
8487import TimelineIcon from ' vue-material-design-icons/ImageMultiple.vue' ;
8588import FoldersIcon from ' vue-material-design-icons/FolderMultiple.vue' ;
8689import UploadIcon from ' vue-material-design-icons/Upload.vue' ;
87- import CalendarSearchIcon from ' vue-material-design-icons/CalendarSearch.vue' ;
8890
8991export default defineComponent ({
9092 name: ' FolderTopMatter' ,
@@ -94,17 +96,23 @@ export default defineComponent({
9496 NcBreadcrumb ,
9597 NcActions ,
9698 NcActionButton ,
99+ NcDateTimePicker ,
97100 PublicUploadHandler ,
98101 HomeIcon ,
99102 ShareIcon ,
100103 TimelineIcon ,
101104 FoldersIcon ,
102105 UploadIcon ,
103- CalendarSearchIcon ,
104106 },
105107
106108 mixins: [UserConfig ],
107109
110+ data() {
111+ return {
112+ goToDate: new Date (),
113+ };
114+ },
115+
108116 computed: {
109117 list(): {
110118 text: string ;
@@ -171,33 +179,9 @@ export default defineComponent({
171179 return (this .$refs .uploadHandler as InstanceType <typeof PublicUploadHandler >) || null ;
172180 },
173181
174- openDatePicker() {
175- const input = this .$refs .dateInput as HTMLInputElement ;
176- const event = { result: null as { min: Date ; max: Date } | null };
177- utils .bus .emit (' memories:timeline:getDateRange' , event );
178- if (event .result ) {
179- input .min = event .result .min .toISOString ().split (' T' )[0 ];
180- input .max = event .result .max .toISOString ().split (' T' )[0 ];
181- }
182-
183- // Temporarily make visible for showPicker to work
184- input .style .width = ' 1px' ;
185- input .style .height = ' 1px' ;
186- try {
187- input .showPicker ();
188- } catch {
189- input .click ();
190- }
191- input .style .width = ' ' ;
192- input .style .height = ' ' ;
193- },
194-
195- onDateSelected(event : Event ) {
196- const input = event .target as HTMLInputElement ;
197- if (! input .value ) return ;
198- const date = new Date (input .value + ' T00:00:00Z' );
182+ onDateSelected(date : Date ) {
183+ if (! date ) return ;
199184 utils .bus .emit (' memories:timeline:scrollToDate' , date );
200- input .value = ' ' ;
201185 },
202186 },
203187});
@@ -219,14 +203,5 @@ export default defineComponent({
219203 gap : 10px ; // Add spacing between actions and progress bar
220204 }
221205
222- .date-input-hidden {
223- position : absolute ;
224- width : 0 ;
225- height : 0 ;
226- overflow : hidden ;
227- border : 0 ;
228- padding : 0 ;
229- margin : 0 ;
230- }
231206}
232207 </style >
0 commit comments