apache / apache/hop

[Feature Request]: Calculator - add Date generator

Open
#4,554 1 comment 0 reactions 0 assignees View on GitHub
awaiting triage Hop Gui P3 Transforms
Dominant language
Java
Stars
1.5k
Forks
476
Avg merge
18h 32m
Merged PRs (30d)
216

Description

### What would you like to happen?

In the Calculator transform there are many operations to get and modify the various parts of a Date (year, month, day of month, day of week, etc.), ma no operation to get a Date object from its parts (year, month, day of month).

It could be useful to add an operation like "Create Date from Year A, Month B and Day of month C": the time part can be defaulted to midnight (and then modified with the already existing operations "Date A + B hours/minutes/seconds").

The current workaround consists in using a User Defined Java Expression transform, and create a field of type `Date` with an expression like:
`new java.util.GregorianCalendar(YEAR_FIELD.intValue(), MONTH_FIELD.intValue() - 1, DAY_OF_MONTH_FIELD.intValue()).getTime()`
_(beware of the -1 in the month field!)_

### Issue Priority

Priority: 3

### Issue Component

Component: Hop Gui, Component: Transforms

Contributor guide

Open the contributing guide

Research direction

Start at the Calculator transform and review its existing date-part operations and the User Defined Java Expression workaround described in the issue. Add an operation that creates a Date from year, month, and day-of-month fields with the time set to midnight, then verify that the resulting Date works with the existing date adjustment operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.