ICU timezone data

This document describes Fuchsia's support for loading ICU timezone data from ICU data files (icudtl.dat). Programs load timezone data dynamically based on the resources most appropriate for their application.

For more details on the general use of ICU APIs in Fuchsia, see International Components for Unicode use in Fuchsia

Make the ICU data available

In order for the system default ICU data files to be visible to a program in Fuchsia, you must include the resource dependency in your package:


Timezone configuration data

To provide a specific version of the timezone data files to your component, request the appropriate directory capability in your component manifest:

// Capabilities used by this component.
use: [
        directory: "tzdata-icu-44-le",
        rights: [ "r*" ],
        path: "/config/tzdata",

Load the ICU data

You must load the ICU data in your program to make the locale data available. Otherwise, no locale data will be available and your ICU code will behave as if the set of i18n data is empty.

  1. Include the ICU data library dependency in your file:


    third_party_icu_headers("icu_headers") {
      headers = [
    executable("bin") {
      testonly = true
      output_name = "tz_version_parrot_cpp"
      sources = [ "" ]
      deps = [


    deps = [ "//src/lib/icu_data/rust/icu_data" ]
    non_rust_deps = [ "//src/lib/icu:lib" ]
  2. Import the ICU data library into your source files:


    #include "src/lib/icu_data/cpp/icu_data.h"


    use icu_data::Loader;
  3. Initialize the ICU data loader:


    const auto result = icu_data::Initialize();
    ASSERT_EQ(result, ZX_OK) << "icu_data::Initialize failed";


    // Load the ICU data
    let _loader = Loader::new().expect("loader constructed successfully");

You are now ready to use ICU data in your program.

Load from tzdata directory

To load the ICU data, initialize the loader with the path to the data directory and revision file:


// Default directory for timezone .res files
constexpr char kDefaultTzdataDir[] = "/config/tzdata";
// Path to file containing the expected time zone database revision ID.
constexpr char kDefaultTzRevisionFilePath[] = "/config/tzdata/revision.txt";
    << "Error: tzdata directory \"" << kDefaultTzdataDir << "\" doesn't exist.";

const auto result = icu_data::InitializeWithTzResourceDirAndValidate(kDefaultTzdataDir,
ASSERT_EQ(result, ZX_OK) << "icu_data::InitializeWithTzResourceDirAndValidate failed";


const DEFAULT_TZDATA_DIR: &str = "/config/tzdata";
const DEFAULT_TZREVISION_FILE_PATH: &str = "/config/tzdata/revision.txt";

// Load the ICU data
let _loader = Loader::new_with_tz_resources_and_validation(
.expect("loader constructed successfully");


Modifying the system time zone information

During development, use the ffx setui plugin to check or set the current time zone ID on a Fuchsia target. For more information about the available options, run the following commands:

ffx config set setui true // only need to run once
ffx setui intl --help