Skip to content

Timezone information is lost when getting DateTime from DtStart #715

@noftaly

Description

@noftaly

Hi,
thanks for the great library.

I've just upgraded to v3 but run into issues when extracting the date out of a dtstart generated from a RRuleSet:

const { RRuleSet } = require('rrule-rust');

// rrule with TZID
const str = `DTSTART;TZID=UTC:20260101T000000
RRULE:FREQ=MINUTELY;INTERVAL=5`;

const rrs = RRuleSet.fromString(str);

rrs.dtstart
// DtStart {
//   value: DateTime {
//     year: 2026,
//     month: 1,
//     day: 1,
//     time: { hour: 0, minute: 0, second: 0, utc: false },  <---- utc: false even though it is UTC
//     offset: undefined  <---- no offset even though tzid was set
//   },
//   tzid: 'UTC'  <---- tz defined in DtStart
// }

rrs.dtstart.value.toDate()
// Error: There is no information about time zone offset

I believe this isn't the correct behaviour, if not for all time zones it should at least recognise UTC.

Also would love a helper on dtstart to get the date without going through value (it feels unnecessary) but that's a personal preference.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions