{"id":13537642,"url":"https://github.com/seljabali/java-time-fun","last_synced_at":"2025-06-24T10:01:42.956Z","repository":{"id":47140224,"uuid":"402993185","full_name":"seljabali/java-time-fun","owner":"seljabali","description":"java.time Kotlin extension functions library.","archived":false,"fork":false,"pushed_at":"2025-03-20T13:02:05.000Z","size":1147,"stargazers_count":61,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T14:08:38.702Z","etag":null,"topics":["calendar","date","date-formatting","date-library","date-time","java","javatime","joda-time","kotlin","kotlin-extensions"],"latest_commit_sha":null,"homepage":"https://seljabali.github.io/java-time-fun","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seljabali.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-04T07:27:08.000Z","updated_at":"2025-03-20T13:02:14.000Z","dependencies_parsed_at":"2024-02-10T11:19:59.766Z","dependency_job_id":"095381b4-88eb-4044-a545-6e7ea6e058fc","html_url":"https://github.com/seljabali/java-time-fun","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seljabali%2Fjava-time-fun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seljabali%2Fjava-time-fun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seljabali%2Fjava-time-fun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seljabali%2Fjava-time-fun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seljabali","download_url":"https://codeload.github.com/seljabali/java-time-fun/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757148,"owners_count":20828841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","date","date-formatting","date-library","date-time","java","javatime","joda-time","kotlin","kotlin-extensions"],"created_at":"2024-08-01T09:01:01.523Z","updated_at":"2025-06-24T10:01:42.945Z","avatar_url":"https://github.com/seljabali.png","language":"Kotlin","readme":"\u003cp align=\"center\" \u003e\n   \u003cimg src=\"screenshots/logo.png\" width=300px alt=\"SwiftDate\" title=\"SwiftDate\"\u003e\n \u003c/p\u003e\n \n\u003ch3 align=\"center\"\u003e\u003cstrong\u003eJava Time Fun\u003c/strong\u003e\u003c/h3\u003e\n\u003cp align=\"center\"\u003eJava Time Kotlin extension functions.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/seljabali/java-time-fun/actions?query=branch%3Amain\"\u003e\u003cimg alt=\"Build Status\" src=\"https://github.com/seljabali/java-time-fun/actions/workflows/main.yml/badge.svg\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://repo1.maven.org/maven2/org/eljabali/sami/javatimefun/javatimefun/\"\u003e\u003cimg alt=\"Maven Central\" src=\"https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Feljabali%2Fsami%2Fjavatimefun%2Fjavatimefun%2Fmaven-metadata.xml\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://kotlinlang.org\"\u003e\u003cimg alt=\"Kotlin\" src=\"https://img.shields.io/badge/Kotlin-2.1.21-orange.svg?style=flat\u0026logo=kotlin\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://mailchi.mp/kotlinweekly/kotlin-weekly-396\"\u003e\u003cimg alt=\"Kotlin Weekly\" src=\"https://skydoves.github.io/badges/kotlin-weekly.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e \u003cbr\u003e\n\n```diff\n- val dateTimeFormatter = DateTimeFormatter.ofPattern(\"yyyyMMdd\")\n- val date = LocalDate.parse(dateText, dateTimeFormatter)\n+ val date = dateText.toLocalDate(\"yyyyMMdd\")\n\n- val dateFormatter = DateTimeFormatter.ofPattern(\"MM/dd/yyyy\")\n- print(dateFormatter.format(date))\n+ print(date.print(\"MM/dd/yyyy\"))\n\n- if (ChronoUnit.YEARS.between(dateOfBirth, LocalDate.now()) \u003c 18) {\n+ if (dateOfBirth.getYearDifference(LocalDates.today) \u003c 18) {\n\n- val zoneId = ZoneId.of(\"America/Los_Angeles\")\n+ val zoneId = ZoneIds.AMERICA_LOS_ANGELES\n```\n\n## Features\n### Parsing\n_Convert strings into Java Time objects with ease_\n```kotlin\nval result = \"01:30 AM\".toLocalTime()\nval result = \"2021-06-07\".toLocalDate()\nval result = \"06/07/2021\".toLocalDate(format = \"MM/dd/yyyy\")\nval result = \"2024-11-15T12:34:56.123456Z\".toLocalDateTime() // handles fractional seconds that Java Time doesn't\nval result = \"2021-10-04T10:10:00+0000\".toZonedDateTime()\n```\n### Creation\n_Create new date/time instances using factory functions_\n```kotlin\nval result = LocalTimeFactory.new(hour = 7, minute = 30)\nval result = LocalDateFactory.new(year = 2024, month = 11, day = 15)\nval result = LocalDateTimeFactory.new(year = 2024, month = 11, day = 15)\nval result = ZonedDateTimeFactory.new(year = 2024, month = 11, day = 15, zoneId = ZoneIds.AMERICA_LOS_ANGELES)\n```\n\n### Conversion from Legacy Date Types\n_Easily convert legacy date objects to Java Time_\n```kotlin\nval result = Date().toLocalDateTime()\nval result = GregorianCalendar().toZonedDateTime()\n```\n\n### Comparisons\n_Compare dates and times at various granularities_\n```kotlin\n// Year\nval result = dateA.compareYear(dateB)\nval result = dateA.isBeforeYear(dateB)\n\n// Month\nval result = dateA.compareMonth(dateB)\nval result = zonedDateA.getMonthDifference(zonedDateB) // auto-conversion to same time zone for expected results\nval result = dateA.isEqualMonth(dateB)\n\n// Day\nval result = dateA.compareDay(dateB)\nval result = dateA.getDayDifference(dateB)\nval result = dateA.isAfterEqualDay(dateB)\n\n// Time\nval result = dateA.compareTime(dateB)\nval result = dateA.getMinuteDifference(dateB)\nval result = dateA.isAfterEqualTime(dateB)\n```\n\n### Formatting\n_Print dates and times using a custom format_\n```kotlin\nval date = \"2021-07-06\".toZonedDateTime()\nval result = date.print(format = \"MM/dd/yyyy\")\n```\n\n### Attributes \u0026 Mutations\n_Query and transform date/time attributes_\n```kotlin\nval result = date.isAtStartOfDay()\nval result = date.getDaysInMonth()\n\nval result = date.atStartOfDay()\nval result = date.getLast(DayOfWeek.FRIDAY)\nval result = date.getNext(DayOfWeek.MONDAY)\n```\n\n### Preset Dates\n_Quickly access commonly used dates_\n```kotlin\nval result = LocalDates.startOfYear()\nval result = LocalDateTimes.tomorrow()\nval result = ZonedDateTimes.nextMonday()\n```\n\n## Installation\nAdd the following to your module’s `build.gradle`:\n```gradle\nrepositories {\n  mavenCentral()\n}\n\ndependencies {\n  implementation(\"org.eljabali.sami.javatimefun:javatimefun:4.0.1\")\n}  \n```\n\n\u003cdetails\u003e\n\u003csummary\u003eFor Android\u003c/summary\u003e\n\nIn addition to the above, you need to desugar your module:\n- Ensure you're using [Gradle Plugin](https://developer.android.com/studio/releases/gradle-plugin#updating-plugin) 4.0.0+.\n- Update module `build.gradle`:\n```gradle\nandroid {\n    defaultConfig {\n        // Required when setting minSdkVersion to 20 or lower\n        multiDexEnabled true\n    }\n\n    compileOptions {\n        // Flag to enable support for the new language APIs\n        coreLibraryDesugaringEnabled true\n        // Sets Java compatibility to Java 8\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n}\n\ndependencies {\n    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'\n}\n```\nFor more information on Android desugaring click [here](https://developer.android.com/studio/write/java8-support#library-desugaring).\n\n\u003c/details\u003e\n\n## Find this library useful? 😏\nIf you like what you see, please star the repository __[as others have](https://github.com/seljabali/java-time-fun/stargazers)__! ⭐️ \u003cbr\u003e\n","funding_links":[],"categories":["Libraries","Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseljabali%2Fjava-time-fun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseljabali%2Fjava-time-fun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseljabali%2Fjava-time-fun/lists"}