File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ declare module 'luxon/src/datetime' {
9
9
toNeo4JDateTime ( this : DateTime ) : Neo . DateTime < number > ;
10
10
toPostgres ( this : DateTime ) : string ;
11
11
[ inspect . custom ] ( ) : string ;
12
+
13
+ // Compatibility with EdgeDB's LocalDate which is a subset of Temporal.PlainDate
14
+ get dayOfWeek ( ) : number ;
15
+ get dayOfYear ( ) : number ;
16
+ get daysInWeek ( ) : number ;
17
+ get monthsInYear ( ) : number ;
18
+ get inLeapYear ( ) : boolean ;
12
19
}
13
20
}
14
21
/* eslint-enable @typescript-eslint/method-signature-style */
@@ -39,3 +46,31 @@ DateTime.prototype[inspect.custom] = function (this: DateTime) {
39
46
const str = this . toLocaleString ( DateTime . DATETIME_SHORT_WITH_SECONDS ) ;
40
47
return `[DateTime] ${ str } ` ;
41
48
} ;
49
+
50
+ Object . defineProperties ( DateTime . prototype , {
51
+ dayOfWeek : {
52
+ get ( this : DateTime ) {
53
+ return this . weekday ;
54
+ } ,
55
+ } ,
56
+ dayOfYear : {
57
+ get ( this : DateTime ) {
58
+ return this . ordinal ;
59
+ } ,
60
+ } ,
61
+ daysInWeek : {
62
+ get ( this : DateTime ) {
63
+ return 7 ;
64
+ } ,
65
+ } ,
66
+ monthsInYear : {
67
+ get ( this : DateTime ) {
68
+ return 12 ;
69
+ } ,
70
+ } ,
71
+ inLeapYear : {
72
+ get ( this : DateTime ) {
73
+ return this . isInLeapYear ;
74
+ } ,
75
+ } ,
76
+ } ) ;
You can’t perform that action at this time.
0 commit comments