Skip to content

Feature/auto upgrade joda#16

Open
pgomulka wants to merge 14 commits into6.8from
feature/auto_upgrade_joda
Open

Feature/auto upgrade joda#16
pgomulka wants to merge 14 commits into6.8from
feature/auto_upgrade_joda

Conversation

@pgomulka
Copy link
Copy Markdown
Owner

@pgomulka pgomulka commented Jan 30, 2020

this is a PoC of auto migrating joda style patterns to java.time
It is basing on joda code responsible for parsing patterns, but instead of populating fields in DateFormatBuilder it appends translated letters into a new pattern.

This had to be a copy paste, as it required modifying (slightly though) methods that were private in joda.

if (i + 1 < length && pattern.charAt(i + 1) == '\'') {
// '' is treated as escaped '
i++;
buf.append(c);//THIS IS THE CHANGE COMPARED TO JODA
Copy link
Copy Markdown
Owner Author

@pgomulka pgomulka Jan 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only change needed in joda's DateTimeFormat

import org.joda.time.format.DateTimeFormatterBuilder;
import org.joda.time.format.ISODateTimeFormat;

public class CustomDateTimeFormat {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy of required methods from DateTimeFormat (unable to extend)

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.

1 participant