Explorar o código

* Merging revisions 616 from trunk:
------------------------------------------------------------------------
r616 | michael | 2019-09-30 15:48:08 +0200 (Mon, 30 Sep 2019) | 1 line

* Fix day names in formatdatetime, fix DateTimeToJSDate
------------------------------------------------------------------------

michael %!s(int64=5) %!d(string=hai) anos
pai
achega
f106f3ef5b
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      packages/rtl/sysutils.pas

+ 4 - 4
packages/rtl/sysutils.pas

@@ -2361,7 +2361,7 @@ Var
 begin
   DecodeDate(Trunc(aDateTime),Y,M,D);
   DecodeTime(Frac(aDateTime),H,N,S,Z);
-  Result:=TJSDate.New(Y,M,D,h,n,s,z);
+  Result:=TJSDate.New(Y,M-1,D,h,n,s,z);
 end;
 
 function JSDateToDateTime(aDate: TJSDate): TDateTime;
@@ -2566,7 +2566,7 @@ end ;
 
 function DayOfWeek(DateTime: TDateTime): integer;
 begin
-  Result := 1 + ((Trunc(DateTime) - 1) mod 7);
+  Result:= 1+((Trunc(DateTime) - 1) mod 7);
   If (Result<=0) then
     Inc(Result,7);
 end;
@@ -3312,8 +3312,8 @@ var
               case Count of
                 1: StoreInt(Day, 0);
                 2: StoreInt(Day, 2);
-                3: StoreString(ShortDayNames[DayOfWeek]);
-                4: StoreString(LongDayNames[DayOfWeek]);
+                3: StoreString(ShortDayNames[DayOfWeek-1]);
+                4: StoreString(LongDayNames[DayOfWeek-1]);
                 5: StoreFormat(ShortDateFormat, Nesting+1, False);
               else
                 StoreFormat(LongDateFormat, Nesting+1, False);