File tree 3 files changed +34
-4
lines changed
admin/components/PaginatedTable
3 files changed +34
-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 * as baseDayJs from 'dayjs/esm/index.js' ;
2
+ import localeData from 'dayjs/esm/plugin/localeData/index.js' ;
3
+ import minMax from 'dayjs/esm/plugin/minMax/index.js' ;
4
+ import isSameOrBefore from 'dayjs/esm/plugin/isSameOrBefore/index.js' ;
5
+ import isSameOrAfter from 'dayjs/esm/plugin/isSameOrAfter/index.js' ;
6
+
7
+ let dayjs = baseDayJs ;
8
+
9
+ if ( baseDayJs . default ) {
10
+ dayjs = baseDayJs . default ;
11
+ }
12
+
13
+ if ( dayjs && dayjs . extend ) {
14
+ dayjs . extend ( localeData ) ;
15
+ dayjs . extend ( minMax ) ;
16
+ dayjs . extend ( isSameOrBefore ) ;
17
+ dayjs . extend ( isSameOrAfter ) ;
18
+ } else if ( ! dayjs ) {
19
+ console . error ( '"dayjs" import is empty.' ) ;
20
+ } else if ( ! dayjs . extend ) {
21
+ console . error ( '"dayjs" import does not implement "extend".' ) ;
22
+ }
23
+
24
+ export {
25
+ dayjs
26
+ } ;
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