You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python target's DateTimeOffset implementation in fable_library/date_offset.py is incomplete. Many members from System.DateTimeOffset either throw at runtime (referenced in Replacements.fs but not implemented in the library) or are silently missing.
Equality/comparison: delegated to date.equals / date.compare
Missing / broken
Constructors
DateTimeOffset(DateTime) — fromDate referenced in Replacements.fs but missing in date_offset.py
DateTimeOffset(Int64 ticks, TimeSpan offset) — fromTicks referenced but missing
DateTimeOffset(DateOnly, TimeOnly, TimeSpan) — not handled
Fields
MaxValue — date_offset.maxValue referenced in Replacements.fs but missing in date_offset.py
UnixEpoch
Properties
UtcDateTime — to_universal_time referenced but missing
LocalDateTime — to_local_time referenced but missing
UtcTicks — getUtcTicks referenced but missing
Date (date-only component as DateTime)
DayOfWeek
DayOfYear
Millisecond
Microsecond
Nanosecond
Ticks (clock time ticks)
TimeOfDay (as TimeSpan)
TotalOffsetMinutes
Methods
Add(TimeSpan) — would go via catch-all to date_offset.add, which is missing
AddDays(float) — catch-all, not implemented
AddHours(float) — catch-all, not implemented
AddMicroseconds(float) — catch-all, not implemented
AddMilliseconds(float) — referenced as addMilliseconds (used for AddTicks), missing
AddMinutes(float) — catch-all, not implemented
AddMonths(int) — catch-all, not implemented
AddSeconds(float) — catch-all, not implemented
AddYears(int) — catch-all, not implemented
AddTicks(int64) — dispatches to addMilliseconds, which is missing
Compare(DateTimeOffset, DateTimeOffset) — static method, not handled
EqualsExact(DateTimeOffset) — not handled
FromFileTime(int64) — not handled
ToFileTime() — not handled
ToLocalTime() — to_local_time referenced but missing
ToOffset(TimeSpan) — not handled
ToUniversalTime() — to_universal_time referenced but missing
ParseExact — not handled
TryParseExact — not handled
Operators
op_addition (DateTimeOffset + TimeSpan) — commented out in Rust extension, missing in date_offset.py
Other
GetHashCode / hash support — Replacements.fs routes to date.dateHash, which does not exist in date.py; DateTimeOffset values cannot be used as map/set keys reliably
Implementation notes
The catch-all branch in Replacements.fs (line ~3022) forwards unknown instance methods to date_offset.<lowerFirst(methodName)>, so many Add* methods will silently try to call missing functions at runtime.
to_local_time and to_universal_time should return DateTimeOffset (not DateTime), consistent with the .NET API.
AddTicks is currently mapped to addMilliseconds(ticks / 10000) — this function needs to be added, and the mapping should be verified for precision.
Equality semantics: .NET compares DateTimeOffset by UTC-normalized instant (not by local time + offset pair). The current delegation to date.equals needs to apply the offset before comparing.
The Rust extension (src/fable-library-py/src/datetime_offset.rs) has stubs for most functions commented out — these should be completed when the Python implementation is stabilized.
Files to change
src/fable-library-py/fable_library/date_offset.py — main implementation
src/Fable.Transforms/Python/Replacements.fs — wire up new functions
tests/Python/TestDateTimeOffset.fs — add test coverage for each implemented member
[Python] Implement missing DateTimeOffset membersSummary
The Python target's
DateTimeOffsetimplementation infable_library/date_offset.pyis incomplete. Many members fromSystem.DateTimeOffseteither throw at runtime (referenced inReplacements.fsbut not implemented in the library) or are silently missing.Currently working
DateTimeOffset(year, month, day, hour, minute, second, millisecond, offset)viacreateYear,Month,Day,Hour,Minute,Second,Offset,DateTime,Now,UtcNowMinValueToString,TryParse,FromUnixTimeMilliseconds,FromUnixTimeSeconds,ToUnixTimeMilliseconds,ToUnixTimeSecondsop_subtraction(DateTimeOffset - DateTimeOffset → TimeSpan, DateTimeOffset - TimeSpan → DateTimeOffset)date.equals/date.compareMissing / broken
Constructors
DateTimeOffset(DateTime)—fromDatereferenced inReplacements.fsbut missing indate_offset.pyDateTimeOffset(Int64 ticks, TimeSpan offset)—fromTicksreferenced but missingDateTimeOffset(DateOnly, TimeOnly, TimeSpan)— not handledFields
MaxValue—date_offset.maxValuereferenced inReplacements.fsbut missing indate_offset.pyUnixEpochProperties
UtcDateTime—to_universal_timereferenced but missingLocalDateTime—to_local_timereferenced but missingUtcTicks—getUtcTicksreferenced but missingDate(date-only component asDateTime)DayOfWeekDayOfYearMillisecondMicrosecondNanosecondTicks(clock time ticks)TimeOfDay(asTimeSpan)TotalOffsetMinutesMethods
Add(TimeSpan)— would go via catch-all todate_offset.add, which is missingAddDays(float)— catch-all, not implementedAddHours(float)— catch-all, not implementedAddMicroseconds(float)— catch-all, not implementedAddMilliseconds(float)— referenced asaddMilliseconds(used forAddTicks), missingAddMinutes(float)— catch-all, not implementedAddMonths(int)— catch-all, not implementedAddSeconds(float)— catch-all, not implementedAddYears(int)— catch-all, not implementedAddTicks(int64)— dispatches toaddMilliseconds, which is missingCompare(DateTimeOffset, DateTimeOffset)— static method, not handledEqualsExact(DateTimeOffset)— not handledFromFileTime(int64)— not handledToFileTime()— not handledToLocalTime()—to_local_timereferenced but missingToOffset(TimeSpan)— not handledToUniversalTime()—to_universal_timereferenced but missingParseExact— not handledTryParseExact— not handledOperators
op_addition(DateTimeOffset + TimeSpan) — commented out in Rust extension, missing indate_offset.pyOther
GetHashCode/ hash support —Replacements.fsroutes todate.dateHash, which does not exist indate.py;DateTimeOffsetvalues cannot be used as map/set keys reliablyImplementation notes
Replacements.fs(line ~3022) forwards unknown instance methods todate_offset.<lowerFirst(methodName)>, so manyAdd*methods will silently try to call missing functions at runtime.to_local_timeandto_universal_timeshould returnDateTimeOffset(notDateTime), consistent with the .NET API.AddTicksis currently mapped toaddMilliseconds(ticks / 10000)— this function needs to be added, and the mapping should be verified for precision.DateTimeOffsetby UTC-normalized instant (not by local time + offset pair). The current delegation todate.equalsneeds to apply the offset before comparing.src/fable-library-py/src/datetime_offset.rs) has stubs for most functions commented out — these should be completed when the Python implementation is stabilized.Files to change
src/fable-library-py/fable_library/date_offset.py— main implementationsrc/Fable.Transforms/Python/Replacements.fs— wire up new functionstests/Python/TestDateTimeOffset.fs— add test coverage for each implemented member