Here’s a README file for the provided .NET Core application:
This is a simple .NET Core application that demonstrates how to work with time zones and daylight saving time using the NodaTime library. The application retrieves the current time and converts it to the London time zone, checking whether it is daylight saving time.
- .NET Core SDK 3.1
- Docker
- libfaketime (used within Docker to simulate different date and time scenarios)
- Main Program: The main program retrieves the current date and time, converts it to the London time zone, and checks if daylight saving time is active.
- Docker Integration: The application is containerized using Docker.
libfaketime
is used to simulate different dates and times to test the application's behavior.
To build the Docker image for this application, run the following command:
docker build -t dotnetcore31-date-app .
You can run the application using Docker with different simulated times:
docker run -e FAKE_TIME='2024-11-11 21:00:00' dotnetcore31-date-app
- Just before the Daylight Saving Time ends:
docker run -e FAKE_TIME='2024-10-27 00:59:00' dotnetcore31-date-app
- Just after the Daylight Saving Time ends:
docker run -e FAKE_TIME='2024-10-27 01:00:00' dotnetcore31-date-app
- Program.cs: Contains the main logic for retrieving and converting the date and time.
- Dockerfile: Instructions to build and run the application inside a Docker container.
- .csproj file: Defines the project and manages dependencies.
- NodaTime (v3.1.11): A date and time library for .NET to handle time zones and more complex date/time scenarios.
- libfaketime: A tool used to simulate different dates and times when running the application within a Docker container. This is useful for testing how the application behaves during different periods, such as Daylight Saving Time transitions.
This project is licensed under the MIT License.
For any questions or issues, please contact the author.
This README provides an overview of the application, its purpose, and instructions for building and running it, including how to simulate different times using libfaketime
.