File tree 3 files changed +36
-4
lines changed
admin/components/PaginatedTable
3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 2
2
import ConfigFilter from ' $lib/admin/ConfigFilter' ;
3
3
import FilterType from ' $lib/admin/FilterType' ;
4
4
import DatePicker from ' @beyonk/svelte-datepicker/src/components/DatePicker.svelte' ;
5
- import { dayjs } from ' @beyonk/svelte-datepicker/src/components/ lib/date-utils' ;
5
+ import { dayjs } from ' $ lib/utils /date-utils' ;
6
6
7
7
export let filter: ConfigFilter ;
8
8
export let change_callback: Function ;
Original file line number Diff line number Diff line change
1
+ import { dayjs as baseDayJs } from 'dayjs' ;
2
+ import localeData from 'dayjs/plugin/localeData' ;
3
+ import minMax from 'dayjs/plugin/minMax' ;
4
+ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore' ;
5
+ import isSameOrAfter from 'dayjs/plugin/isSameOrAfter' ;
6
+
7
+ /**
8
+ * This entire file is a copy/paste of the one from @beyonk/svelte-datepicker
9
+ * @see ../../../node_modules/@beyonk/svelte-datepicker/src/components/lib/date-utils.js
10
+ */
11
+ const dayjs = function ( ) {
12
+ if ( baseDayJs && baseDayJs . extend ) {
13
+ baseDayJs . extend ( localeData ) ;
14
+ baseDayJs . extend ( minMax ) ;
15
+ baseDayJs . extend ( isSameOrBefore ) ;
16
+ baseDayJs . extend ( isSameOrAfter ) ;
17
+ } else if ( ! baseDayJs ) {
18
+ console . error ( '"dayjs" import is empty.' ) ;
19
+ } else if ( ! baseDayJs . extend ) {
20
+ console . error ( '"dayjs" import does not implement "extend".' ) ;
21
+ }
22
+
23
+ return baseDayJs ( ...arguments ) ;
24
+ }
25
+
26
+ export {
27
+ dayjs
28
+ } ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import preprocess from 'svelte-preprocess';
3
3
import path from 'path' ;
4
4
import fs from 'fs' ;
5
5
6
- const copyPlugin = function ( options ) {
6
+ const copyFile = function ( options ) {
7
7
return function ( ) {
8
8
const targetDir = path . dirname ( options . target ) ;
9
9
if ( ! fs . existsSync ( targetDir ) ) {
@@ -29,14 +29,18 @@ const config = {
29
29
vite : {
30
30
prebundleSvelteLibraries : true ,
31
31
plugins : [
32
- copyPlugin ( {
32
+ copyFile ( {
33
33
source : './node_modules/bootstrap/dist/js/bootstrap.bundle.min.js' ,
34
34
target : './static/bootstrap.min.js' ,
35
35
} ) ,
36
- copyPlugin ( {
36
+ copyFile ( {
37
37
source : './node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map' ,
38
38
target : './static/bootstrap.min.js.map' ,
39
39
} ) ,
40
+ copyFile ( {
41
+ source : './src/lib/utils/date-utils.ts' ,
42
+ target : './node_modules/@beyonk/svelte-datepicker/src/components/lib/date-utils.js' ,
43
+ } ) ,
40
44
] ,
41
45
ssr : {
42
46
noExternal : [ 'dayjs' ]
You can’t perform that action at this time.
0 commit comments