Welcome to Codate 👋! Codate is a developer-friendly tool that simplifies date formatting across multiple programming languages. Whether you're working with JavaScript, Python, Java, C#, Ruby, PHP, Swift, Kotlin, Go, or Rust,
Codate helps you generate the perfect date format code snippet effortlessly.
Try it Now »
- Multi-language Support: Generate date format code snippets for
JavaScript,Python,Java,C#,Ruby,PHP,Swift,Kotlin,Go, andRust. - Various Date Formats: Choose from a wide range of date formats including
YYYY-MM-DD,MM/DD/YYYY,DD/MM/YYYY, and more. - Easy to Use: Select your preferred programming language and date format, then copy the generated
code snippet. - Developer-Friendly: Save
timeand avoiderrorswith our intuitive interface designed specifically for developers.
- Select Language: Choose your preferred programming
language. - Select Date Format: Pick a
date formatthat suits your project's needs. - Copy Code Snippet: Copy the generated
codesnippet and paste it into your project.
- Select Language:
JavaScript - Select Date Format:
YYYY-MM-DD - Copy Code Snippet:
function formatDate(date) {
const d = new Date(date);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
console.log(formatDate(new Date()));
// Outputs: 2024-05-01Got feedback or ideas? We'd love to hear from you! Open an issue or pull request on GitHub.
👾 COD-1337: Hey there, fellow coder! Ready to dive into the world of Codate contributions? Let's embark on this adventure together!
-
Fork the Repo:
- Hit that
Forkbutton up top to snag your own copy of the repo.
- Hit that
-
Clone Your Fork:
-
Fire up your terminal and type:
git clone https://github.com/BadreddineIbril/Codate.git cd Codate
-
Stay organized with a fresh branch:
git checkout -b COD-<index>-
Navigate to the Language Data File:
- Open
core/data/languages/index.ts.
- Open
-
Add the New Language:
-
Pop a new entry into the
LANGUAGESarray. -
Don't forget to get the language icons from Devicon for a more visually appealing display.
{ id: "lang_id", name: "Language Name", icon: "URL_to_language_icon", }
-
-
Navigate to the Date Formats File:
- Open
core/data/date-formats/index.ts.
- Open
-
Add Function Implementations:
-
For each date format, find its file under
core/data/date-formats/formats/. -
Now, add the function for the new language. For instance, for
DD/MM/YYYY HH:mm:export const DDMMYYYY_HHmm: FunctionDefinition[] = [ { language_id: "your_new_language_id", function: ` // Your awesome function goes here! `; }, ... ];
-
-
Stage and Commit:
git add . git commit -m "Added magic ✨"
-
Push Your Branch:
git push origin COD<index>
- Open a PR:
- Head over to the original Codate repo.
- Click "Compare & pull request" and give us a heads-up on your changes.
MIT License. See the LICENSE file for more details.
