@odata2ts/converter-luxon
Version:
Luxon based odata2ts compatible converters for date and time related OData types
23 lines • 716 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.durationToLuxonConverter = void 0;
const luxon_1 = require("luxon");
exports.durationToLuxonConverter = {
id: "durationToLuxonConverter",
from: "Edm.Duration",
to: "luxon.Duration",
convertFrom: function (value) {
if (typeof value !== "string") {
return value;
}
const luxon = luxon_1.Duration.fromISO(value);
return luxon.isValid ? luxon : undefined;
},
convertTo: function (value) {
if (!value) {
return value;
}
return value.isValid ? value.toISO() : undefined;
},
};
//# sourceMappingURL=DurationToLuxonConverter.js.map