@kenjiuno/msgreader
Advanced tools
Comparing version 1.17.0-alpha.3 to 1.17.0-alpha.4
import DataStream from "./DataStream"; | ||
/** | ||
* StandardDate | ||
* | ||
* A SYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs on this operating system. If the time zone does not support daylight saving time or if the caller needs to disable daylight saving time, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the DaylightDate member of this structure must also be specified. | ||
* | ||
* Otherwise, the system assumes the time zone data is invalid and no changes will be applied. | ||
* | ||
* To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence during the month if that day of the week does not occur 5 times). | ||
* | ||
* Using this notation, specify 02:00 on the first Sunday in April as follows: wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 02:00 on the last Thursday in October as follows: wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5. | ||
* | ||
* If the wYear member is not zero, the transition date is absolute; it will only occur one time. Otherwise, it is a relative date that occurs yearly. | ||
* | ||
* @see [TIME_ZONE_INFORMATION (timezoneapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-time_zone_information) | ||
*/ | ||
export interface TransitionSystemTime { | ||
year: number; | ||
month: number; | ||
dayOfWeek: number; | ||
day: number; | ||
hour: number; | ||
minute: number; | ||
} | ||
/** | ||
* | ||
* @see [TZRULE | Microsoft Learn](https://learn.microsoft.com/en-us/office/client-developer/outlook/auxiliary/tzrule) | ||
@@ -36,7 +59,7 @@ * @see [TZREG | Microsoft Learn](https://learn.microsoft.com/en-us/office/client-developer/outlook/auxiliary/tzreg) | ||
*/ | ||
standardDate: string | null; | ||
standardDate: TransitionSystemTime; | ||
/** | ||
* The time to switch to daylight saving time. | ||
*/ | ||
daylightDate: string | null; | ||
daylightDate: TransitionSystemTime; | ||
} | ||
@@ -43,0 +66,0 @@ /** |
@@ -52,4 +52,4 @@ "use strict"; | ||
var lDaylightBias = ds.readInt32(); | ||
var stStandardDate = (0, utils_1.readSystemTime)(ds); | ||
var stDaylightDate = (0, utils_1.readSystemTime)(ds); | ||
var stStandardDate = (0, utils_1.readTransitionSystemTime)(ds); | ||
var stDaylightDate = (0, utils_1.readTransitionSystemTime)(ds); | ||
var rule = Object.assign({}, { | ||
@@ -61,4 +61,4 @@ flags: wFlags_1, | ||
daylightBias: lDaylightBias, | ||
standardDate: (stStandardDate === null || stStandardDate === void 0 ? void 0 : stStandardDate.toUTCString()) || null, | ||
daylightDate: (stDaylightDate === null || stDaylightDate === void 0 ? void 0 : stDaylightDate.toUTCString()) || null, | ||
standardDate: stStandardDate, | ||
daylightDate: stDaylightDate, | ||
}); | ||
@@ -65,0 +65,0 @@ tz.rules.push(rule); |
import DataStream from "./DataStream"; | ||
import { TransitionSystemTime } from "./TZDEFINITIONParser"; | ||
/** | ||
@@ -37,3 +38,3 @@ * Contains a stream that maps to the persisted format of a TZREG structure, | ||
*/ | ||
standardDate: string | null; | ||
standardDate: TransitionSystemTime; | ||
/** | ||
@@ -46,4 +47,4 @@ * matches the stDaylightDate's wYear field | ||
*/ | ||
daylightDate: string | null; | ||
daylightDate: TransitionSystemTime; | ||
} | ||
export declare function parse(ds: DataStream): TzReg | null; |
@@ -13,5 +13,5 @@ "use strict"; | ||
var wStandardYear = ds.readUint16(); | ||
var stStandardDate = (0, utils_1.readSystemTime)(ds); | ||
var stStandardDate = (0, utils_1.readTransitionSystemTime)(ds); | ||
var wDaylightYear = ds.readUint16(); | ||
var stDaylightDate = (0, utils_1.readSystemTime)(ds); | ||
var stDaylightDate = (0, utils_1.readTransitionSystemTime)(ds); | ||
return Object.assign({}, { | ||
@@ -22,5 +22,5 @@ bias: lBias, | ||
standardYear: wStandardYear, | ||
standardDate: (stStandardDate === null || stStandardDate === void 0 ? void 0 : stStandardDate.toUTCString()) || null, | ||
standardDate: stStandardDate, | ||
daylightYear: wDaylightYear, | ||
daylightDate: (stDaylightDate === null || stDaylightDate === void 0 ? void 0 : stDaylightDate.toUTCString()) || null, | ||
daylightDate: stDaylightDate, | ||
}); | ||
@@ -27,0 +27,0 @@ } |
import DataStream from "./DataStream"; | ||
import { TransitionSystemTime } from "./TZDEFINITIONParser"; | ||
/** | ||
@@ -51,1 +52,5 @@ * @internal | ||
export declare function readSystemTime(ds: DataStream): Date | null; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function readTransitionSystemTime(ds: DataStream): TransitionSystemTime; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readSystemTime = exports.emptyToNull = exports.msftUuidStringify = exports.toHex4 = exports.toHex2 = exports.toHex1 = exports.toHexStr = exports.uInt2int = exports.arraysEqual = void 0; | ||
exports.readTransitionSystemTime = exports.readSystemTime = exports.emptyToNull = exports.msftUuidStringify = exports.toHex4 = exports.toHex2 = exports.toHex1 = exports.toHexStr = exports.uInt2int = exports.arraysEqual = void 0; | ||
/** | ||
@@ -158,1 +158,25 @@ * @internal | ||
exports.readSystemTime = readSystemTime; | ||
/** | ||
* @internal | ||
*/ | ||
function readTransitionSystemTime(ds) { | ||
// SYSTEMTIME structure (minwinbase.h) | ||
// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime | ||
var wYear = ds.readUint16(); | ||
var wMonth = ds.readUint16(); | ||
var wDayOfWeek = ds.readUint16(); | ||
var wDay = ds.readUint16(); | ||
var wHour = ds.readUint16(); | ||
var wMinute = ds.readUint16(); | ||
var wSecond = ds.readUint16(); | ||
var wMilliseconds = ds.readUint16(); | ||
return { | ||
year: wYear, | ||
month: wMonth, | ||
dayOfWeek: wDayOfWeek, | ||
day: wDay, | ||
hour: wHour, | ||
minute: wMinute, | ||
}; | ||
} | ||
exports.readTransitionSystemTime = readTransitionSystemTime; |
{ | ||
"name": "@kenjiuno/msgreader", | ||
"version": "1.17.0-alpha.3", | ||
"version": "1.17.0-alpha.4", | ||
"description": "Outlook Item File (.msg) reader in JavaScript Npm Module", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
323735
8990