Skip to content

Add TimeUnitValue property#4926

Merged
kgrgreer merged 1 commit intodevelopmentfrom
add-TimeUnitValue
Mar 23, 2026
Merged

Add TimeUnitValue property#4926
kgrgreer merged 1 commit intodevelopmentfrom
add-TimeUnitValue

Conversation

@lchanmann
Copy link
Collaborator

@lchanmann lchanmann commented Mar 21, 2026

TimeUnitValue is similar to UnitValue but for unitPropName of type 'foam.time.TimeUnit' with helper function to get milliseconds from the property.

Example:

foam.CLASS({
  name: 'MyData',
  properties: [
    {
        class: 'TimeUnitValue',
        name: 'expiresIn',
        unitPropName: 'timeUnit'
    },
    {
        class: 'Enum',
        of: 'foam.time.TimeUnit',
        name: 'timeUnit',
        value: 'HOUR'
    }
  ]
});

let data = MyData.create({expiresIn: 2});
data.expiresIn;  // returns 2
data.getExpiredInMs(); // return 7200000

@kgrgreer kgrgreer merged commit 3840047 into development Mar 23, 2026
1 check passed
@lchanmann lchanmann deleted the add-TimeUnitValue branch March 23, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants