Allow inserting custom date format in license header

Open
#2,720 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

No implementation files or tests are named. Start by locating the existing Spotless license-header handling for the year or $NOW token, then trace how header values are tested. Done means supporting a date format such as $NOW.format("MMMM dd, YYYY") and producing the requested formatted date in the generated header.

Written by the indexing model from the issue text.

Description

enhancement

Similar to https://github.com/diffplug/spotless/issues/1147, I have a custom license header format which included the date when the file was created.
This date is somewhat custom as well, it uses the format long_month day, year, e.g. November 14, 2025.

The IntelliJ plugin supports the format method for any date https://www.jetbrains.com/help/idea/copyright-profiles.html#profile_page

It would be great if Spotless also had a similar method to customize the format of the current time instead of only inserting the year.

The ideal format would be something like

Copyright (c) $NOW.format("MMMM dd, YYYY")

which would display as

Copyright (c) November 14, 2025
Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.