How can the darkness be past when in the next verse John says that some still walk in darkness? The darkness is past not for the world, but for believers in whose hearts the true light has begun to shine through the knowledge of Christ.
Does the darkness that is past refer to the time before Christ was born? How can the Old Testament period be spoken of in this way? No, John uses the term darkness to refer to the realm where sin reigns under the tyranny of Satan. The darkness is past in the case of those who have begun to follow the Light of the world, and who have God’s Spirit abiding in them.
How can this commandment be said to be true in him and in us? A commandment is not usually true or false. What John means is that the commandment finds its fulfilment in him and is us because it is obeyed: by him perfectly, and by us imperfectly but genuinely.